Has anyone succeed to send an mail(SMTP GOOGLE) with Zend_Log.I found this http://framework.zend.com/manual/en/zend.log.writers.html Chapter 32.2.4. Writing to Email but by default it's using mail(), but I want to use SMTP.So until now my code looks like this:
$mailconf = array('ssl'=>'ssl', 'auth' => 'login', 'username' => '[email protected]', 'password' => 'mypass', 'port'=>'465');
$transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $mailconf);
$mail = new Zend_Mail();
$mail->setFrom('[email protected]')
->addTo('[email protected]');
$writer = new Zend_Log_Writer_Mail($mail);
// On fixe le sujet du mail
$writer->setSubjectPrependText('Important Log Events');
// Only email warning level entries and higher.
$writer->addFilter(Zend_Log::WARN);
$loggerZendMail = new Zend_Log();
$loggerZendMail->addWriter($writer);
$loggerZendMail->log('unable to connect to database',Zend_Log::WARN);
I'm getting this error:
Fatal error: Uncaught exception 'Zend_Log_Exception' with message 'Unable to send mail' in C:\wamp\www\zf_log\Zend\Log\Writer\Mail.php:256 Stack trace: #0 C:\wamp\www\zf_log\Zend\Log.php(84): Zend_Log_Writer_Mail->shutdown() #1 C:\wamp\www\zf_log\Zend\Controller\Action.php(512): Zend_Log->__destruct() #2 C:\wamp\www\zf_log\Zend\Controller\Action.php(512): IndexController->indexAction() #3 C:\wamp\www\zf_log\Zend\Controller\Dispatcher\Standard.php(288): Zend_Controller_Action->dispatch('indexAction') #4 C:\wamp\www\zf_log\Zend\Controller\Front.php(945): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #5 C:\wamp\www\zf_log\index.php(30): Zend_Controller_Front->dispatch() #6 {main} thrown in C:\wamp\www\zf_log\Zend\Log\Writer\Mail.php on line 256
Any suggestions?