| 12345678910111213141516171819202122232425262728293031 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!-- Reviewed: no -->
- <sect1 id="zend.mail.html-mails">
- <title>HTML E-Mail</title>
- <para>
- To send an e-mail in <acronym>HTML</acronym> format, set the body using the method
- <methodname>setBodyHTML()</methodname> instead of <methodname>setBodyText()</methodname>.
- The <acronym>MIME</acronym> content type will automatically be set to
- <property>text/html</property> then. If you use both <acronym>HTML</acronym> and Text
- bodies, a multipart/alternative <acronym>MIME</acronym> message will automatically be
- generated:
- </para>
- <example id="zend.mail.html-mails.example-1">
- <title>Sending HTML E-Mail</title>
- <programlisting language="php"><![CDATA[
- $mail = new Zend_Mail();
- $mail->setBodyText('My Nice Test Text');
- $mail->setBodyHtml('My Nice <b>Test</b> Text');
- $mail->setFrom('somebody@example.com', 'Some Sender');
- $mail->addTo('somebody_else@example.com', 'Some Recipient');
- $mail->setSubject('TestSubject');
- $mail->send();
- ]]></programlisting>
- </example>
- </sect1>
- <!--
- vim:se ts=4 sw=4 et:
- -->
|