SMTP 服务器响应:530 5.7.0 必须首先发出 STARTTLS 命令
SMTP 服务器响应:530 5.7.0 必须首先发出 STARTTLS 命令
当我在 php 脚本文件中使用 mail() 函数时,我收到此错误消息...
我正在使用 gmail SMTP 服务器,而 gmail 使用 STARTTLS,这是安全的 SSL 我已经在 contact.php 文件中使用了这些命令
ini_set("SMTP","smtp.gmail.com");
ini_set("sendmail_from","<email-address>@gmail.com>");
,那么我可以使用什么命令来启用 STARTTLS 或在 php、ini 文件中进行配置?
SMTP server response: 530 5.7.0 Must issue a STARTTLS command first
I get this error message when i use mail() function in php script file...
I m using gmail SMTP server and gmail using STARTTLS which is secure SSL
and i already use these commands in my contact.php file
ini_set("SMTP","smtp.gmail.com");
ini_set("sendmail_from","<email-address>@gmail.com>");
so what command i can use to enable STARTTLS or configure in php,ini file??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
首先,确保您的 PHP 安装支持 SSL(在
phpinfo()
的输出中查找“openssl”部分)。您可以在 PHP.ini 中进行以下设置:
First, make sure you PHP installation has SSL support (look for an "openssl" section in the output from
phpinfo()
).You can set the following settings in your PHP.ini:
问题解决了,
我编辑了文件
/etc/postfix/master.cf
并评论
并将该行从 改为
并
工作正常
Problem Solved,
I edited the file
/etc/postfix/master.cf
and commented
and changed the line from
to
And worked on fine
我知道 PHPMailer 库可以处理这种 SMTP 事务。
另外,带有 sendmail-SSL 库的假 sendmail 应该可以完成这项工作。
I know that PHPMailer library can handle that kind of SMTP transactions.
Also, a fake sendmail with sendmail-SSL library should do the job.
就我而言,斯威夫特·梅勒也无能为力。我在这里找到了一个解决方案: http://forum.powweb.com/showthread.php?t =73406 - 因此,在 EHLO 命令之后,需要发送 STARTTLS 命令,使用
stream_socket_enable_crypto( $connection, true, STREAM_CRYPTO_METHOD_TLS_CLIENT );
启用加密,然后再次发送 EHLO 命令。只有这样我才能使用“顽固”的 SMTP 服务器发送电子邮件。In my case, Swift Mailer couldn't help either. I found a solution here: http://forum.powweb.com/showthread.php?t=73406 - so after EHLO command one needs to send STARTTLS command, enabling cryptography with
stream_socket_enable_crypto( $connection, true, STREAM_CRYPTO_METHOD_TLS_CLIENT );
and again EHLO command. Only this allowed me to send emails with my "stubborn" SMTP server.开箱即用的 Swift Mailer 无法执行 STARTTLS,但是有些 好人已经为它写了一个补丁。
我发现修补它有点麻烦(可能是以错误的方式进行的),因此将其压缩以供下载:带有 STARTTLS 的 Swift Mailer
Out of the box Swift Mailer can't do STARTTLS, however some nice guys have written a patch for it.
I found patching it was a bit of a chore (probably went about it the wrong way), so have zipped it up ready for download here: Swift Mailer with STARTTLS
我对以下内容有错误的响应:
原来我使用了错误的连接变量,所以我只需将其更改为:
如果使用 TLS,请记住在之前和之后放置 HELO:
I had a false response for the following:
turns out I use the wrong connection variable, so I just had to change it to:
If using TLS remember to put HELO before and after:
我将分享我的方法,它在实施以下操作后对我有用:
打开 Php.ini 文件并通过从 Gmail SMTP 设置
从[邮件功能]中删除注释smtp 服务器并匹配它们的值。
此外,sendmail SMTP 服务器是一个假服务器。除了文本终端之外什么也没有(尝试在上面写任何东西。:P)。
它将使用 gmail s,tp 发送邮件。
因此,通过匹配 Gmail SMTP 设置来正确配置它:
I am going to share my way and it worked for me after implementing following:
Open Php.ini file and fill the all the values in the respective fields by taking ref from Gmail SMTP Settings
Remove comments from the [mail function] Statements which are instructions to the smtp Server and Match their values.
Also the sendmail SMTP server is a Fake server. Its nothing beside a text terminal (Try writing anything on it. :P).
It will use gmail s,tp to send Mails.
So configure it correctly by matching Gmail SMTP settings:
我遇到了同样的问题,我找到的解决方案是添加以下内容:
I had the same problem and the solution I found was to add this:
对于 Windows,我可以通过在 SMTP 虚拟服务器上启用 TLS 进行安全通信来使其正常工作。如果没有证书,TLS 将无法在 SMTP 虚拟服务器上使用。此链接将提供所需的步骤。
https: //support.microsoft.com/en-ie/help/4014125/how-to-configure-iis-smtp-for-outgoing-tls-authentication
For Windows, I was able to get it working by enabling TLS for secure communication on the SMTP Virtual server. TLS will not be available on the SMTP virtual server without a certificate. This link will give the steps needed.
https://support.microsoft.com/en-ie/help/4014125/how-to-configure-iis-smtp-for-outgoing-tls-authentication