Gmail SMTP 在 ec2 实例中不起作用

2024-08-23php开发问题
4

本文介绍了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 实例中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

PHP实现DeepL翻译API调用
DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以...
2025-08-20 php开发问题
168

PHP通过phpspreadsheet导入Excel日期数据处理方法
PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的...
2024-10-23 php开发问题
287

mediatemple - 无法使用 codeigniter 发送电子邮件
mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)...
2024-08-23 php开发问题
11

Laravel Gmail 配置错误
Laravel Gmail Configuration Error(Laravel Gmail 配置错误)...
2024-08-23 php开发问题
16

将 PHPMailer 用于 SMTP 的问题
Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)...
2024-08-23 php开发问题
4

关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题
Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)...
2024-08-23 php开发问题
17