[英]Laravel 5.7: On-Demand e-mail Notification via AWS SES treats my recipient e-mail as a sender e-mail and wants it to be verified address
I want to send a simple on-demand e-mail notification in Laravel 5.7.我想在 Laravel 5.7 中发送一个简单的按需电子邮件通知。
I went to AWS SES and under Email Addresses I added do-not-reply@foo
as a sender.我去了 AWS SES 并在电子邮件地址下添加了do-not-reply@foo
作为发件人。 Then I click on the verification link on do-not-reply@foo
to confirm it.然后我点击do-not-reply@foo
上的验证链接进行确认。
I configured my .env
:我配置了我的.env
:
MAIL_FROM_ADDRESS=do-not-reply@foo
MAIL_FROM_NAME="Foo System"
MAIL_DRIVER=smtp
MAIL_HOST=email-smtp.us-west-2.amazonaws.com
MAIL_PORT=587
MAIL_USERNAME=xxx
MAIL_PASSWORD=xxx
MAIL_ENCRYPTION=tls
I took username and password from here:我从这里获取了用户名和密码:
I did php artisan config:clear
and php artisan cache:clear
.我做了php artisan config:clear
和php artisan cache:clear
。
Now in terms of my PHP code I have:现在就我的 PHP 代码而言,我有:
$this->notificationClass = (new ReflectionClass($notificationClass))->getShortName();
$this->notificationData = $notificationData;
$this->notification
->route('slack', config('logging.channels.slack.url')) // slack works great all the time
->route('mail', 'my-inbox-address-123@gmail.com') // this is address where I want notification to be sent
->notify(new $notificationClass(
$this->getNotificationTitle(),
$this->getNotificationContent()
));
And the content of $notificationClass
is: $notificationClass
的内容是:
<?php
namespace App\Notifications\Sync;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Messages\SlackMessage;
class SyncSuccessfullyCompletedNotification extends AbstractBaseSyncNotification
{
public function toSlack()
{
return (new SlackMessage)
->success()
->content(sprintf('*Synchronization Successful*```%s```', $this->message));
}
public function toMail()
{
return (new MailMessage)
->from(config('mail.from.address'), config('mail.from.name'))
->subject($this->title)
->view('mail.notifications.sync_successfully_completed_notification', [
'content' => sprintf('<pre>%s</pre>', $this->message),
]);
}
}
So my-inbox-address-123@gmail.com
is just my gmail company inbox.所以my-inbox-address-123@gmail.com
只是我的 gmail 公司收件箱。 When I execute the artisan command responsible for doing something and sending this notification I get:当我执行负责做某事并发送此通知的工匠命令时,我得到:
Swift_TransportException : Expected response code 250 but got code "554", with message "554 Message rejected: Email address is not verified. The following identities failed the check in region US-WEST-2: my-inbox-address-123@gmail.com " Swift_TransportException :预期响应代码 250,但得到代码“554”,消息“554 消息被拒绝:电子邮件地址未验证。以下身份未能在 US-WEST-2 区域进行检查:my-inbox-address-123@gmail。 com”
at /home/vagrant/Code/iosportal/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:457 453|在/home/vagrant/Code/iosportal/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:457 453| $this->eventDispatcher->dispatchEvent($evt, 'responseReceived'); $this->eventDispatcher->dispatchEvent($evt, 'responseReceived'); 454| 454| } 455|第455话456|第456话if (!$valid) {如果(!$有效){
457|第457话$this->throwException(new Swift_TransportException('Expected response code '.implode('/', $wanted).' but got code "'.$code.'", with message "'.$response.'"', $code)); $this->throwException(new Swift_TransportException('Expected response code '.implode('/', $wanted).' 但得到代码 "'.$code.'", with message "'.$response.'"', $代码)); 458|第458话} 459|第459话} 460| 460| 461| 461| /** Get an entire multi-line response using its sequence number */ /** 使用序列号获取完整的多行响应 */
Exception trace:异常跟踪:
1 Swift_Transport_AbstractSmtpTransport::assertResponseCode("554 Message rejected: Email address is not verified. The following identities failed the check in region US-WEST-2: my-inbox-address-123@gmail.com ") /home/vagrant/Code/iosportal/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:341 1 Swift_Transport_AbstractSmtpTransport::assertResponseCode("554 消息被拒绝:电子邮件地址未验证。以下身份在 US-WEST-2 区域检查失败:my-inbox-address-123@gmail.com ") /home/vagrant/Code /iosportal/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:341
2 Swift_Transport_AbstractSmtpTransport::executeCommand(" . ", []) /home/vagrant/Code/iosportal/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php:305 2 Swift_Transport_AbstractSmtpTransport::executeCommand(" . ", []) /home/vagrant/Code/iosportal/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php:305
Please use the argument -v to see more details.请使用参数 -v 查看更多详细信息。
Why?为什么? I don't get this.我不明白这个。 My sender is verified, why it wants to verify a recipient?我的发件人已通过验证,为什么要验证收件人?
Indeed when I send this message from verified account to the same verified account the email arrives correctly, but this is nonsense.事实上,当我将此消息从经过验证的帐户发送到同一个经过验证的帐户时,电子邮件会正确到达,但这是无稽之谈。
Your account must be in sandbox
mode, which means every email address has to be verified.您的帐户必须处于sandbox
模式,这意味着必须验证每个电子邮件地址。
Check if you are in sandbox mode:检查您是否处于沙盒模式:
To get out of sandbox mode:要退出沙盒模式:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.