Zend_Mail-HtmlMails.xml 1.1 KB

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