Documentation

HTML E-Mail - Zend_Mail

HTML E-Mail

To send an e-mail in HTML format, set the body using the method setBodyHTML() instead of setBodyText(). The MIME content type will automatically be set to text/html then. If you use both HTML and Text bodies, a multipart/alternative MIME message will automatically be generated:

Example #1 Sending HTML E-Mail

  1. $mail = new Zend_Mail();
  2. $mail->setBodyText('My Nice Test Text');
  3. $mail->setBodyHtml('My Nice <b>Test</b> Text');
  4. $mail->setFrom('somebody@example.com', 'Some Sender');
  5. $mail->addTo('somebody_else@example.com', 'Some Recipient');
  6. $mail->setSubject('TestSubject');
  7. $mail->send();

Copyright

© 2006-2021 by Zend by Perforce. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts