Php Laravel 5.7:通过AWS SES的随需应变电子邮件通知将我的收件人电子邮件视为发件人电子邮件,并希望其地址得到验证
我想发送一个简单的Laravel 5.7版本 我去了AWS SES,并在电子邮件地址下添加了Php Laravel 5.7:通过AWS SES的随需应变电子邮件通知将我的收件人电子邮件视为发件人电子邮件,并希望其地址得到验证,php,laravel,amazon-web-services,email,amazon-ses,Php,Laravel,Amazon Web Services,Email,Amazon Ses,我想发送一个简单的Laravel 5.7版本 我去了AWS SES,并在电子邮件地址下添加了不要-reply@foo作为发件人。然后我点击不要上的验证链接-reply@foo确认 我配置了我的.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_USE
不要-reply@foo
作为发件人。然后我点击不要上的验证链接-reply@foo
确认
我配置了我的.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
我从这里获取用户名和密码:
我做了php-artisan-config:clear
和php-artisan-cache:clear
现在就我的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()
));
$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),
]);
}
}
您的帐户必须处于沙箱模式,这意味着必须验证每个电子邮件地址
检查您是否处于沙箱模式:
登录到
选择您所在的地区
在电子邮件发送下,选择发送统计信息
如果您处于沙箱模式,您将看到一条横幅告诉您这一点
要退出沙箱模式:
登录到
在支持中心打开一个案例
填写表格。如果计划从多个区域发送,请对每个区域重复此操作
谢谢你,约翰。我已经向AWS提供了支持,他们关闭了沙盒模式。一切正常。