Zend_Mail-HtmlMails.xml 1.0 KB

123456789101112131415161718192021222324252627282930
  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 HTML 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 <code>text/html</code>
  9. then. If you use both HTML and Text bodies, a multipart/alternative <acronym>MIME</acronym>
  10. message will automatically be generated:
  11. </para>
  12. <example id="zend.mail.html-mails.example-1">
  13. <title>Sending HTML E-Mail</title>
  14. <programlisting language="php"><![CDATA[
  15. $mail = new Zend_Mail();
  16. $mail->setBodyText('My Nice Test Text');
  17. $mail->setBodyHtml('My Nice <b>Test</b> Text');
  18. $mail->setFrom('somebody@example.com', 'Some Sender');
  19. $mail->addTo('somebody_else@example.com', 'Some Recipient');
  20. $mail->setSubject('TestSubject');
  21. $mail->send();
  22. ]]></programlisting>
  23. </example>
  24. </sect1>
  25. <!--
  26. vim:se ts=4 sw=4 et:
  27. -->