1 <?xml version="1.0" encoding="UTF-8"?>
3 <sect1 id="zend.mail.html-mails">
4 <title>HTML E-Mail</title>
7 To send an e-mail in <acronym>HTML</acronym> format, set the body using the method
8 <methodname>setBodyHTML()</methodname> instead of <methodname>setBodyText()</methodname>.
9 The <acronym>MIME</acronym> content type will automatically be set to <code>text/html</code>
10 then. If you use both <acronym>HTML</acronym> and Text bodies, a multipart/alternative
11 <acronym>MIME</acronym> message will automatically be generated:
14 <example id="zend.mail.html-mails.example-1">
15 <title>Sending HTML E-Mail</title>
17 <programlisting language="php"><![CDATA[
18 $mail = new Zend_Mail();
19 $mail->setBodyText('My Nice Test Text');
20 $mail->setBodyHtml('My Nice <b>Test</b> Text');
21 $mail->setFrom('somebody@example.com', 'Some Sender');
22 $mail->addTo('somebody_else@example.com', 'Some Recipient');
23 $mail->setSubject('TestSubject');