Created
June 28, 2011 15:42
-
-
Save ajbonner/1051424 to your computer and use it in GitHub Desktop.
Add an attachment to an email with Zend_Form
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$mail = new Zend_Mail(); | |
$mail->setFrom('[email protected]', 'Me') | |
->addTo($to) | |
->setSubject($subject) | |
->setBodyText($message); | |
$file = '/path/to/a/file'; | |
$at = new Zend_Mime_Part(file_get_contents($file)); | |
$at->filename = basename($file); | |
$at->disposition = Zend_Mime::DISPOSITION_ATTACHMENT; | |
$at->encoding = Zend_Mime::ENCODING_8BIT; | |
$mail->addAttachment($at); | |
$mail->send(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment