Send e-mail with attachments in Zend Framework


Send an e-mail containing attachments with Zend Framework.


Zend offers an easier solution for sending e-mail with attachements than plain PhP. 

Basically the object has to be instantiated and then just configuring the parameters.


$email_body = “<div>Body text here</div>”;

$mail = new Zend_Mail();
$mail->setFrom(‘’, ‘Sender name’);
$mail->addTo(‘’, ‘Receiver name’);
$mail->setSubject(‘E-mail with Zend, and attachments’);

$attachment1 = file_get_contents(‘’);
$file = $mail->createAttachment($attachment1);


About admin

Just another php developer trying to give something back to the community.
This entry was posted in PhP, Tools and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s