phpmailer / sendmail返回错误“对等连接重置”
Posted
技术标签:
【中文标题】phpmailer / sendmail返回错误“对等连接重置”【英文标题】:phpmailer / sendmail returning error "Connection reset by peer" 【发布时间】:2016-04-29 01:02:47 【问题描述】:我正在尝试使用 gmail 帐户从 localhost 运行 phpmailer/sendmail。我使用 XAMPP。
我使用http://www.html-form-guide.com/php-form/php-registration-form.html的模板
我已经尝试了几个星期,但仍然没有成功。 您对以下日志有什么想法吗?
我是初学者,如果您需要更多数据,请随时问我。 谢谢
崩溃.txt
date/time : 2016-01-22, 12:23:46, 747ms
computer name : **
user name : SYSTEM <admin>
registered owner : Microsoft / Microsoft
operating system : Windows XP Media Center x64 Service Pack 3 build 2600 (in fact this is a compatibility as admin. My real version is Win7 x64
system language : English
system up time : 12 days 2 hours
program up time : 21 seconds
processors : 8x Intel(R) Core(TM) i7-2670QM CPU @ 2.20GHz
physical memory : 2936/8044 MB (free/total)
free disk space : (C:) 165.48 GB
display mode : 1024x768, 32 bit
process id : $6d20
allocated memory : 17.00 MB
command line : "C:\xampp\sendmail\sendmail.exe" -t
executable : sendmail.exe
exec. date/time : 2012-04-16 18:30
compiled with : Delphi 2006/07
madExcept version : 3.0l
callstack crc : $1d5da2f6, $426ead6b, $426ead6b
exception number : 1
exception class : EIdSocketError
exception message : Socket Error # 10054 Connection reset by peer.
调试日志
16/01/22 12:23:25 ** --- MESSAGE BEGIN ---
16/01/22 12:23:25 ** To: email <email@gmail.com>
16/01/22 12:23:25 ** Subject: Your registration with user11.com
16/01/22 12:23:25 ** Date: Fri, 22 Jan 2016 12:23:25 +0100
16/01/22 12:23:25 ** Return-Path: nobody@localhost
16/01/22 12:23:25 ** From: Root User <nobody@localhost>
16/01/22 12:23:25 ** Message-ID: <f7667d2c9812101585751b11c67b9c84@localhost>
16/01/22 12:23:25 ** X-Priority: 3
16/01/22 12:23:25 ** X-Mailer: PHPMailer (phpmailer.sourceforge.net) [version 2.0.4]
16/01/22 12:23:25 ** MIME-Version: 1.0
16/01/22 12:23:25 ** Content-Transfer-Encoding: 8bit
16/01/22 12:23:25 ** Content-Type: text/plain; charset="utf-8"
16/01/22 12:23:25 **
16/01/22 12:23:25 ** Hello email
16/01/22 12:23:25 **
16/01/22 12:23:25 ** Thanks for your registration with user11.com
16/01/22 12:23:25 ** Please click the link below to confirm your registration.
16/01/22 12:23:25 ** http://localhost/project_webapp/registration_login_forms/confirmreg.php?code=a3c8d5758bdcec87a8ac4dfe8c85fa1d
16/01/22 12:23:25 **
16/01/22 12:23:25 ** Regards,
16/01/22 12:23:25 ** Webmaster
16/01/22 12:23:25 ** user11.com
16/01/22 12:23:25 **
16/01/22 12:23:25 ** --- MESSAGE END ---
16/01/22 12:23:25 ** Connecting to smtp.gmail.com:587
16/01/22 12:23:46 ** Disconnected.
16/01/22 12:23:46 ** Disconnected.
16/01/22 12:23:46 ** Disconnected.
16/01/22 12:23:46 ** Socket Error # 10054<EOL>Connection reset by peer.
sendmail.ini:
smtp_server=smtp.gmail.com
smtp_port=587
smtp_ssl=ssl
error_logfile=error.log
debug_logfile=debug.log
auth_username=email@gmail.com
auth_password=*******
pop3_server=
pop3_username=
pop3_password=
force_sender=email@gmail.com
force_recipient=
hostname=smtp.gmail.com
php.ini
[mail function]
smtp=smtp.gmail.com
smtp_port = 587
; For Win32 only.
sendmail_from = email@gmail.com
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
mail.add_x_header=Off
【问题讨论】:
PHPMailer 2.0.4 已经过时很多很多年了。我很惊讶它完全有效! Get the latest 并将您的代码基于提供的示例。 确实如此。这是一个好的开始。我下载了最新版本,它运行良好。谢谢 【参考方案1】:下载最新版本是解决方案!我只是将 smtp 端口设置为 587 以便与 gmail 一起使用。(Synchro 建议的解决方案;)
使用最新版本确实是一个好的开始。
【讨论】:
以上是关于phpmailer / sendmail返回错误“对等连接重置”的主要内容,如果未能解决你的问题,请参考以下文章
阿里云centos 7 创建postfix服务器,并进行stmp验证,并结合phpmailer进行邮件发送
aws Lightsail sendmail zencart 关于设置邮箱发送邮件的问题
(CVE-2016-10033)PHPMailer 远程代码执行漏洞