HTML E-Mail

Attachments

Files can be attached to an e-mail using the createAttachment() method. The default behavior of Zend_Mail is to assume the attachment is a binary object (application/octet-stream), that it should be transferred with base64 encoding, and that it is handled as an attachment. These assumptions can be overridden by passing more parameters to createAttachment():

Example #1 E-Mail Messages with Attachments

  1. span style="color: #808080; font-style: italic;">// build message...
  2. 'image/gif'

If you want more control over the MIME part generated for this attachment you can use the return value of createAttachment() to modify its attributes. The createAttachment() method returns a Zend_Mime_Part object:

  1. span style="color: #ff0000;">'image/gif''test.gif'

An alternative is to create an instance of Zend_Mime_Part and add it with addAttachment():

  1. span style="color: #ff0000;">'image/gif''test.gif'

HTML E-Mail