1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
<?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:
-->
|