使用Laravel调用AWS SES发送邮件失败:邮箱未验证报错
Hey, let's break down exactly what's causing this error and how to fix it step by step.
First, let's decode that error message: The MessageRejected error with a Sender type is AWS SES telling you that the email address you're trying to send from hasn't been verified in your SES account. This is super common if your AWS SES account is still in the sandbox mode (which all new accounts start in).
Here's how to resolve this:
Verify your sender email in AWS SES
Log into your AWS Console, navigate to the SES service (make sure you're in theeu-west-1region since your error points to that endpoint). Go to the "Email Addresses" section under "Identity Management", click "Verify a New Email Address", enter the email you're using asMAIL_FROM_ADDRESSin your Laravel app, then check that email inbox for a verification link from AWS and click it to confirm ownership.Double-check your Laravel environment config
Open your.envfile and make sure these values are correct (theMAIL_FROM_ADDRESSmust match the verified email):MAIL_MAILER=ses MAIL_FROM_ADDRESS=your-verified-email@domain.com MAIL_FROM_NAME="Your App Name" AWS_ACCESS_KEY_ID=your-aws-access-key AWS_SECRET_ACCESS_KEY=your-aws-secret-key AWS_DEFAULT_REGION=eu-west-1Test with a verified recipient (for sandbox mode)
While in sandbox mode, SES only allows sending to verified email addresses (both senders and recipients). So if you're testing, make sure thetoaddress is also verified in SES the same way as your sender email.Request to exit SES sandbox (for production use)
If you need to send emails to non-verified addresses (like real users), submit a request to AWS to move your SES account out of sandbox mode. You can do this via the SES console by clicking "Request Production Access" and filling out the form with details about your use case, sending volume, etc.
Quick recap of the error
That truncated error Email address is no... is just SES cutting off the full message, which would be something like "Email address is not verified". The core issue is that SES sandbox mode enforces verified identities to prevent spam, so you just need to go through the verification steps above.
内容的提问来源于stack exchange,提问作者Mike

