zend framework zend_mail not sending email

1k Views Asked by At

Inherited a zend framework application version 1.12 and as of recent stopped sending emails.

indexcontroller.php

$mail = new Zend_Mail('UTF-8');
                $mail->addTo($sender_email);
                $mail->setSubject("Result of Payment Transaction (Success)");
                ob_start();
                include APPLICATION_PATH . 
                 '/views/scripts/file.phtml';
                $message = ob_get_clean();

                $mail->setBodyText($message);
                $mail->setFrom('[email protected]');
                $mail->send();

application.ini

                   ;EMAIL SETTTING
resources.mail.transport.type = Zend_Mail_Transport_Smtp
resources.mail.transport.host = "smtp.gmail.com"
resources.mail.transport.port = 465 
resources.mail.transport.auth = "login"
resources.mail.transport.username = "[email protected]"
resources.mail.transport.password = "pass"
resources.mail.transport.ssl = "ssl"

Bootstrap.php

         $emailConfig = array(
        'auth' => 'login',
        'username' => Zend_Registry::get('config')->email->username,
        'password' => Zend_Registry::get('config')->email->password,
        'ssl' => Zend_Registry::get('config')->email->protocol,
        'port' => Zend_Registry::get('config')->email->port
    ); 

    $mailTransport = new Zend_Mail_Transport_Smtp(
            Zend_Registry::get('config')->email->server, $emailConfig);
    Zend_Mail::setDefaultTransport($mailTransport);

Outputting error I am getting is,

Exception information:
Message: Could not open socket

Stack trace:
1. library/Zend/Mail/Protocol/Smtp.php(167): Zend_Mail_Protocol_Abstract->_connect('ssl://smtp.gmai...')
2. library/Zend/Mail/Transport/Smtp.php(199): Zend_Mail_Protocol_Smtp->connect()
3. library/Zend/Mail/Transport/Abstract.php(348): Zend_Mail_Transport_Smtp->_sendMail()

I looked at if the sever is connecting which it is, telnet smtp.gmail.com 465 connected Username password is correct I also attempt to change to tls but still no success

any feedback or some reference would be much appreciated

0

There are 0 best solutions below