email - php 5.6 mail and SSL -


i found myself unable send mails since upgraded php5.6.

$to = "test1 <*******@gmail.com>"; $body = "hi,\n\n test email";  $headers = array(     'from' => '*******@gmail.com',     'to' => $to,     'subject' => 'test email' );  $smtp = mail::factory('smtp', array(     'host' => 'smtp.sendgrid.com',     'port' => '587',     'auth' => 'login',     'username' => '*****',     'password' => '*****', ));  $mail = $smtp->send($to, $headers, $body);  if (pear::iserror($mail)) {     echo $mail->getmessage(); } else {     echo "<p> message sent!</p>"; } 

login authentication failure [smtp: starttls failed (code: 220, response: begin tls negotiation now)]

if use gmail account code, error too

$smtp = mail::factory('smtp',array (     'host' => 'ssl://smtp.googlemail.com',     'port' => '465',     'auth' => 'login',     'username' => '******@gmail.com',     'password' => '*******' )); 

authentication failure [smtp: invalid response code received server (code: 534, response: 5.7.14 please log in via web browser , 5.7.14 try again. 5.7.14 learn more @ 5.7.14 https://support.google.com/mail/answer/78754 jz4sm22875767wjb.16 - gsmtp)]

i have oid application running zf1, , found there problem on call zend_mail_protocol_smtp :

stream_socket_enable_crypto($this->_socket, true, stream_crypto_method_tls_client)

i've read changes had been made in php 5.6 concerning openssl, don't know changes need do.

i had same trouble , stumbled upon solution, , these related changes in php 5.6 (which i'm not happy about).

  1. the verify_peer , verify_peer_name default set true - requiring level of security between 2 machines involved in streamed port. don't want when i'm dealing smtp, starttls encryption enough me. turn these off added code net/smtp.php file

    $options = array('ssl' => array('verify_peer_name' => false, 'verify_peer' => false));

    $result = $this->_socket->connect($this->host, $this->port, $persistent, $timeout, $options);

  2. the socket timeout default specified in php.ini not being used function. changed default in 'smtp.php' to:

    $timeout = 60; // null;

hope helps else. cheers murray


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -