使用Zend_Mail发送电子邮件时出现致命错误

时间:2013-11-22 06:09:51

标签: php zend-mail

我在test.php中编写了以下代码

<?php
require_once 'Zend/Mail.php';   
require_once 'Zend/Mail/Transport/Smtp.php';    
$subject="send my email from qq to 163";
$mailbody='stay hungry stay foolish';
$envelope='2546606474@qq.com';
$config = array('auth' => 'login',
'username' => '2546606474',
'password' => 'XXXXXXXXXXX');
$transport = new Zend_Mail_Transport_Smtp('smtp.qq.com',$config);
$mail = new Zend_Mail('GBK');
$mail->setBodyHtml($mailbody);
$mail->setFrom($envelope, '2546606474');
$mail->addTo('kanonwind@163.com','kanonwind');
$mail->setSubject('we create future with our hands');
$mail->send($transport);
?>

我在localhost测试,我成功收到了来自2546606474@qq.com的电子邮件 然后我将文件上传到我的网站进行测试,发生错误:

Fatal error: Uncaught exception 'Zend_Mail_Protocol_Exception' with message 'Connection timed
out' in /home/u629656826/public_html/mr2/Zend/Mail/Protocol/Abstract.php:277 
Stack trace: 
#0 /home/u629656826/public_html/mr2/Zend/Mail/Protocol/Smtp.php(167):
Zend_Mail_Protocol_Abstract->_connect('tcp://smtp.qq.c...') 
#1 /home/u629656826/public_html/mr2/Zend/Mail/Transport/Smtp.php(199): Zend_Mail_Protocol_Smtp-    >connect() 
#2 /home/u629656826/public_html/mr2/Zend/Mail/Transport/Abstract.php(348):
Zend_Mail_Transport_Smtp->_sendMail()
#3 /home/u629656826/public_html/mr2/Zend/Mail.php(1194): Zend_Mail_Transport_Abstract->sen
(Object(Zend_Mail)) 
#4 /home/u629656826/public_html/mr2/test.php(21): Zend_Mail->send(Object
(Zend_Mail_Transport_Smtp)) 
#5 {main} thrown in /home/u629656826/public_html/mr2/Zend/Mail/Protocol/Abstract.php on line 277 

我不知道如何解决问题。

0 个答案:

没有答案