目前正在处理用户注册表单(正如预期的那样)向注册用户发送电子邮件。
客户决定使用AWS SES,所以我已经配置了这个。
.ENV
MAIL_DRIVER=smtp
MAIL_HOST=email-smtp.eu-west-1.amazonaws.com
MAIL_PORT=587
MAIL_USERNAME=my_username
MAIL_PASSWORD=my_password
MAIL_ENCRYPTION=null
还定义了以下凭据:
SES_KEY=keyRetrievedFromMyCredentialsInSES
SES_SECRET=passwordRetrievedFromMyCredentialsInSES
还有telnet email-smtp.eu-west-1.amazonaws.com 587
Trying 52.19.235.197...
Connected to ses-smtp-eu-west-1-prod-345515633.eu-west-1.elb.amazonaws.com.
这里可能出现什么问题?
答案 0 :(得分:1)
如果没有ADDRESS
和NAME
设置,它可能无效。
MAIL_DRIVER=smtp
MAIL_HOST=null
MAIL_PORT=null
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS = 'hello@example.com'
MAIL_FROM_NAME = 'Example'
.env
中的更改设置后。运行config:cache
:
php artisan config:cache
答案 1 :(得分:0)
查看文档-> https://laravel.com/docs/7.x/mail
composer require guzzlehttp/guzzle
composer require aws/aws-sdk-php
MAIL_DRIVER=ses
MAIL_HOST=email-smtp.eu-west-1.amazonaws.com //aws SMTP Settings -> check mail host
MAIL_PORT=465
MAIL_USERNAME=smpt_username //aws SMTP Settings -> click Create My SMTP Credentials
MAIL_PASSWORD=smpt_password //aws SMTP Settings -> click Create My SMTP Credentials
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=your_email //aws Email Addresses -> add email address -> send test email (in sendbox mode you can send email only on same email for testing)
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID= aws_access_key_id //create user or in existing user check access key
AWS_SECRET_ACCESS_KEY= secret_access_key //create user or in existing user check secret key
AWS_DEFAULT_REGION=eu-west-1 //change with your region
AWS_BUCKET=
'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('Secret access key'),
'region' => env('AWS_SECRET_ACCESS_KEY', 'eu-west-1'), // change with your region
],
php artisan config:cache