Created
September 21, 2012 14:39
-
-
Save zircote/3761857 to your computer and use it in GitHub Desktop.
Zend_Mail with inline Zend_Mime_Part
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 | |
require_once 'Zend/Mail.php'; | |
require_once 'Zend/Mime/Part.php'; | |
require_once 'Zend/Mail/Transport/Smtp.php'; | |
$config = array( | |
'name' => 'smtp.gmail.com', | |
'auth' => 'login', | |
'username' => '[email protected]', | |
'password' => 'blahblah', | |
'ssl' => 'tls', | |
'port' => 587 | |
); | |
$mail = new Zend_Mail(); | |
$mail->addTo('[email protected]') | |
->setFrom('[email protected]') | |
->setBodyText('text body'); | |
$at = new Zend_Mime_Part(file_get_contents('./public/favicon.ico')); | |
$at->filename = 'favicon.ico'; | |
$at->disposition = Zend_Mime::DISPOSITION_INLINE; | |
$at->encoding = Zend_Mime::ENCODING_BASE64; | |
$at->type = 'image/png'; | |
$mail->addAttachment($at); | |
$mail->send(new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment