使用 Laravel 通过亚马逊 ses 发送邮件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42761754/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 15:33:01  来源:igfitidea点击:

Send mail via amazon ses with Laravel

phplaravelamazon-web-serviceszend-frameworkamazon-ses

提问by rap-2-h

I try to send mail via Laravel with amazon SES from custom sender addresses. When I try to send it, I have this error:

我尝试通过 Laravel 使用亚马逊 SES 从自定义发件人地址发送邮件。当我尝试发送它时,出现以下错误:

exception 'Aws\Ses\Exception\SesException' with message 'Error executing "SendRawEmail" on "https://email.us-east-1.amazonaws.com"; AWS HTTP error: Client error: POST https://email.us-east-1.amazonaws.comresulted in a 400 Bad Requestresponse:

<ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/"> <Error> <Type>Sender</Type> <Code>MessageReje (truncated...) MessageRejected (client): Email address is not verified. The following identities failed the check in region US-EAST-1: =?utf-8?Q?Rapha=C3=ABl?= XXXXX <[email protected]>, [email protected] - <ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/"> <Error> <Type>Sender</Type> <Code>MessageRejected</Code> <Message>Email address is not verified. The following identities failed the check in region US-EAST-1: =?utf-8?Q?Rapha=C3=ABl?= XXXXX <[email protected]>, [email protected]</Message> </Error> <RequestId>ee2403e6-07d7-11e7-83bf-69ca6c084a61 </ErrorResponse>

异常“Aws\Ses\Exception\SesException”,消息为“在“ https://email.us-east-1.amazonaws.com”上执行“SendRawEmail”时出错;AWS HTTP 错误:客户端错误:POST https://email.us-east-1.amazonaws.com导致400 Bad Request响应:

<ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/"> <Error> <Type>Sender</Type> <Code>MessageReje (truncated...) MessageRejected (client) : 电子邮件地址未经验证。以下身份未通过区域 US-EAST-1 的检查:=?utf-8?Q?Rapha=C3=ABl?= XXXXX <[email protected]>, [email protected] - <ErrorResponse xmlns="http ://ses.amazonaws.com/doc/2010-12-01/"> <Error> <Type>Sender</Type> <Code>MessageRejected</Code> <Message>电子邮件地址未经验证。以下身份未通过区域 US-EAST-1 的检查:=?utf-8?Q?Rapha=C3=ABl?= XXXXX <[email protected]>, [email protected]</Message> </Error > <RequestId>ee2403e6-07d7-11e7-83bf-69ca6c084a61 <

So it seems my sender mail address is not accepted. In other hand, one application built with Zend Framework (I did not built it) with the same Amazon account works for same sender address.

所以似乎我的发件人邮件地址不被接受。另一方面,一个使用 Zend Framework 构建的应用程序(我没有构建它)具有相同的 Amazon 帐户适用于相同的发件人地址。

I think there is something to do to accept "random" sender addresses (it works for the Zend one). In the configuration of the Zend application, there is one more information for SES:

我认为需要做一些事情来接受“随机”发件人地址(它适用于 Zend 地址)。在 Zend 应用的配置中,还有一个关于 SES 的信息:

'arn' => array(
    'emails' => 'arn:aws:sns:us-east-1:xxxxxxxxx:Emails'
),

Is this this line which make it work? How can I do the same thing with Laravel?

这是使它起作用的这条线吗?我怎样才能用 Laravel 做同样的事情?

采纳答案by Mircea Soaica

You can only send emails after verifying the email address (the email in the FROM field). This is an anti spam / anti phishing measure.

您只能在验证电子邮件地址(发件人字段中的电子邮件)后发送电子邮件。这是一种反垃圾邮件/反网络钓鱼措施。

http://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-email-addresses.html

http://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-email-addresses.html

回答by Yevgeniy Afanasyev

If you are having restrictions making you to send mail to only verified email addresses and domains, or to the Amazon SES mailbox simulator.

如果您受到限制,只能将邮件发送到经过验证的电子邮件地址和域,或发送到 Amazon SES 邮箱模拟器。

Than you are in a SES Sandbox.

比您在 SES 沙盒中。

You need your account be removed from the Amazon SES sandbox

您需要从 Amazon SES 沙箱中删除您的账户

read more here

在这里阅读更多

https://docs.aws.amazon.com/ses/latest/DeveloperGuide/request-production-access.html

https://docs.aws.amazon.com/ses/latest/DeveloperGuide/request-production-access.html