SES Email not verified for “to” field in Laravel

2019-08-30 22:45发布

问题:

I have:

Mail::send('emails.booking-confirmation', [
        'name' => $name,
        'email' => $email,
        'tel' => $tel,
        'msg' => $msg,
        'date' => Carbon::parse($date)->format('l, jS \o\f F, Y \a\t H:ia'),
        'service' => $q->service,
        'duration' => $q->duration . ' minutes'
    ], function ($m) use ($name, $email) {
        $m->from('myemail@ddress.co.uk', 'Subject');
        $m->to($email, $name)->subject('Your Booking');
    });

When sending using AWS SES I get:

Error executing "SendRawEmail" on "https://email.eu-west-1.amazonaws.com"; AWS HTTP error: Client error: `POST https://email.eu-west-1.amazonaws.com` resulted in a `400 Bad Request` response:
<ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/">
<Error>
<Type>Sender</Type>
<Code>MessageReje (truncated...)
MessageRejected (client): Email address is not verified. - <ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/">
<Error>
<Type>Sender</Type>
<Code>MessageRejected</Code>
<Message>Email address is not verified.</Message>
</Error>
<RequestId>8551cf11-f420-11e5-b4ac-bf30e6ff71ee</RequestId>
</ErrorResponse>

My address and domain are verified.

If I do:

...
], function ($m) use ($name, $email) {
        $m->from('myemail@ddress.co.uk', 'Subject');
        $m->to('myemail@ddress.co.uk', $name)->subject('Your Booking');
    });

It works perfectly, but is completely useless.

How do I get this working so I can send email to users who fill out my form?

回答1:

It is complaining your To: email address is not verified. Looks like you are in SES Sandbox mode. Until you change your SES account to production account, you have to verify your Sender email address too.

When you tested both From and To are your email address (which is already verified).

From: Verifying Email Addresses in Amazon SES

Until your account is out of the Amazon SES sandbox, you must also verify the email address of every recipient except for the recipients provided by the Amazon SES mailbox simulator. For more information about the mailbox simulator, see Testing Amazon SES Email Sending. For more information about moving out of the sandbox, see Moving Out of the Amazon SES Sandbox.

Moving Out of the Amazon SES Sandbox