开发者

Zend_Mail fail to send email, output message : Connection timeout

开发者 https://www.devze.com 2022-12-21 20:51 出处:网络
I try to write codes about sending email using Zend Framework. Here is the code, $mail = new Zend_Mail(\'utf-8\');

I try to write codes about sending email using Zend Framework. Here is the code,

$mail = new Zend_Mail('utf-8');
$mailConfig = array(
'auth'=> 'login',
'username'  => 'sample@gmail.com',
'password'  => 'samplepassword',
'ssl'       => 'tls',
'port'      => '587';

$tr = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $mailConfig);
Zend_Mail::setDefaultTransport($tr);

$mail->setSubject('test email');
$mail->setBodyText('body');

$mail->setFrom('sample@gmail.com', 'Just a sample');

$mail->addTo('anothersample@gmail.com', 'Another sample');

$mail->send();

These codes work perfectly a开发者_JAVA技巧t my local computer, but failed to send email at the server side with return message "Connection time out". I guess there might be some configuration problem on the server side, but I don't know what it is. Anyone with idea what is going wrong?


Try 'ssl'='ssl' and port 995.


Contact the admin of the server and ask if they allow outgoing communication on port 587.
It seems like they are blocking certain traffic.

0

精彩评论

暂无评论...
验证码 换一张
取 消