【发布时间】:2015-06-19 08:56:31
【问题描述】:
我正在使用 phpmailer 发送电子邮件。这是我的代码。
require 'PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->SMTPDebug = 1;
$mail->isSMTP();
$mail->Host = 'mail.distech.com.my';
$mail->SMTPAuth = true;
$mail->Username = 'myemail';
$mail->Password = 'mypassword';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
我已经在我的电脑上使用了这个代码,它可以工作。电子邮件已发送。但是,当我在朋友的电脑上运行这段代码时,会出现错误。
错误:
2015-06-19 08:42:12 CLIENT -> SERVER: EHLO 192.168.1.20
2015-06-19 08:42:12 CLIENT -> SERVER: STARTTLS Warning: stream_socket_enable_crypto() [function.stream-socket-enable-crypto]: SSL: The operation completed successfully. in C:\xampp\htdocs\ehars\phpmailer\class.smtp.php on line 344
2015-06-19 08:42:12 SMTP Error: Could not connect to SMTP host.
2015-06-19 08:42:12 CLIENT -> SERVER: QUIT Notice: fwrite() [function.fwrite]: send of 6 bytes failed with errno=10054 An existing connection was forcibly closed by the remote host. in C:\xampp\htdocs\ehars\phpmailer\class.smtp.php on line 937
2015-06-19 08:42:12 SMTP ERROR: QUIT command failed:
2015-06-19 08:42:12 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting Message could not be sent.Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
我是 phpmailer 的新手,可能是什么问题。我已经尝试在两台计算机上 ping mail.distech.com.my 并且都工作得很好。请帮帮我,谢谢。
【问题讨论】: