沃梦达 / 编程问答 / php问题 / 正文

Gmail SMTP 在 ec2 实例中不起作用

Gmail SMTP is not working in ec2 instance(Gmail SMTP 在 ec2 实例中不起作用)

本文介绍了Gmail SMTP 在 ec2 实例中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用基于 Ubuntu 的 ec2 实例,最近我在 aws 上转移了我的代码,似乎电子邮件功能无法正常工作.我正在使用 gmail SMTP 服务下面是我的代码

i am using Ubuntu based ec2 instance, recently i have shifted my code on aws and it seemed email functionality is not working. I am using gmail SMTP service below is my code

'Smtpmail'=>array(
        'class'=>'application.extensions.smtpmail.PHPMailer',
        'Host'=>"smtp.gmail.com",
        'Username'=>'username',
        'Password'=>'password',
    'From'=>'from addr', 
    'setForm'=>'from name',
        'Mailer'=>'smtp',
    'SMTPSecure'=>'tls',
        'Port'=>25,
        'SMTPAuth'=>true, 
    ),

this code is working on my unix based server but on aws it is giving below error

邮件程序错误:以下发件人地址失败:test@email.com:邮件未接受来自服务器,530,5.5.1 需要身份验证.如需了解详情,请访问 530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 y6sm27370508qen.21 - gsmtp

Mailer Error: The following From address failed: test@email.com : MAIL not accepted from server,530,5.5.1 Authentication Required. Learn more at 530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 y6sm27370508qen.21 - gsmtp

请帮忙

推荐答案

不接受来自服务器的邮件

MAIL not accepted from server

由于过去使用 EC2 实例的人发送的垃圾邮件滥用,几乎所有流行的邮件提供商阻止从 EC2 实例接收电子邮件.电子邮件和反垃圾邮件措施的世界部分是技术性的,部分是政治性的.为此,AWS 提供了 Amazon Simple Email Service.

Because of the spam abuse that has historically been sent from people using EC2 instances, virtually ALL popular mail providers block the receipt of email from EC2 instances. The world of email and anti-spam measures is part-technical, part-political. For this reason, AWS offers Amazon Simple Email Service.

AWS 与邮件提供商合作,确保 SES 使用的节点已被列入白名单,因为我们预先进行了适当的授权/验证.

AWS works with mail providers to ensure that the nodes used by SES have been whitelisted because we do proper authorization/verification up-front.

在这种情况下,从一台服务器而不是 AWS 发送电子邮件的能力很可能是由于 EC2 的 IP 范围被 Google 列入了黑名单.

In this case, the ability to send email from one server but not AWS is, in all likelihood, due to EC2's IP range being blacklisted by Google.

需要验证

如果相同的用户/通行证在其他地方工作而没有更改,我不知道该说什么.我知道很多邮件流量不再使用端口 25,而是选择 587 用于非 SSL 和 465 用于 SSL.这是我开始寻找解决方案的第一个地方.

If the same user/pass works elsewhere without changes, I'm not sure what to say. I know that lots and lots of mail traffic no longer uses port 25, opting instead for 587 for non-SSL and 465 for SSL. That's the first place I'd start poking to find a solution.

这篇关于Gmail SMTP 在 ec2 实例中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:Gmail SMTP 在 ec2 实例中不起作用

基础教程推荐