Sending Email with attachment in Zend Framework
<?php
require_once 'Zend/Mail.php' ; // include on header on Controller where you want use
$message='Report of last months log files Please keep in mind Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry"s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.' ;
//echo $message;die;
$subject = 'Subject of Email';
$config = array('auth' => 'login',
'username' => 'Email Id', // To Be Required bhupendra.iec@hotmail.com
'password' => 'xxxxxxx'); // To Be Required xxxxxxx
// SMTP must be change according to Mail Server
$transport = new Zend_Mail_Transport_Smtp('smtp.live.com', $config);
$mail = new Zend_Mail();
$mail->setType(Zend_Mime::MULTIPART_RELATED);
$mail->setBodyText($message);
$mail->setBodyHtml($message);
$mail->setFrom('bhupendra.iec@hotmail.com');
$mail->addTo('bhupendra.iec@gmail.com');
$mail->setSubject($subject);
$fileContents = file_get_contents($_FILES['resume']['tmp_name']); // To Be Required Attachement File name
$at=$mail->createAttachment($fileContents);
$at->filename = $_FILES['resume']['name']; // To Be Required Attachement File name
$mail->send($transport);
$this->_redirect("index/index/msg/suc");
?>
require_once 'Zend/Mail.php' ; // include on header on Controller where you want use
$message='Report of last months log files Please keep in mind Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry"s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.' ;
//echo $message;die;
$subject = 'Subject of Email';
$config = array('auth' => 'login',
'username' => 'Email Id', // To Be Required bhupendra.iec@hotmail.com
'password' => 'xxxxxxx'); // To Be Required xxxxxxx
// SMTP must be change according to Mail Server
$transport = new Zend_Mail_Transport_Smtp('smtp.live.com', $config);
$mail = new Zend_Mail();
$mail->setType(Zend_Mime::MULTIPART_RELATED);
$mail->setBodyText($message);
$mail->setBodyHtml($message);
$mail->setFrom('bhupendra.iec@hotmail.com');
$mail->addTo('bhupendra.iec@gmail.com');
$mail->setSubject($subject);
$fileContents = file_get_contents($_FILES['resume']['tmp_name']); // To Be Required Attachement File name
$at=$mail->createAttachment($fileContents);
$at->filename = $_FILES['resume']['name']; // To Be Required Attachement File name
$mail->send($transport);
$this->_redirect("index/index/msg/suc");
?>