rap-2-h
rap-2-h

Reputation: 31948

Send mail via amazon ses with Laravel

I try to send mail via Laravel with amazon SES from custom sender addresses. When I try to send it, I have this error:

exception 'Aws\Ses\Exception\SesException' with message 'Error executing "SendRawEmail" on "https://email.us-east-1.amazonaws.com"; AWS HTTP error: Client error: POST https://email.us-east-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. The following identities failed the check in region US-EAST-1: =?utf-8?Q?Rapha=C3=ABl?= XXXXX <[email protected]>, [email protected] - <ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/"> <Error> <Type>Sender</Type> <Code>MessageRejected</Code> <Message>Email address is not verified. The following identities failed the check in region US-EAST-1: =?utf-8?Q?Rapha=C3=ABl?= XXXXX <[email protected]>, [email protected]</Message> </Error> <RequestId>ee2403e6-07d7-11e7-83bf-69ca6c084a61 </ErrorResponse>

So it seems my sender mail address is not accepted. In other hand, one application built with Zend Framework (I did not built it) with the same Amazon account works for same sender address.

I think there is something to do to accept "random" sender addresses (it works for the Zend one). In the configuration of the Zend application, there is one more information for SES:

'arn' => array(
    'emails' => 'arn:aws:sns:us-east-1:xxxxxxxxx:Emails'
),

Is this this line which make it work? How can I do the same thing with Laravel?

Upvotes: 1

Views: 7525

Answers (2)

Yevgeniy Afanasyev
Yevgeniy Afanasyev

Reputation: 41280

If you are having restrictions making you to send mail to only verified email addresses and domains, or to the Amazon SES mailbox simulator.

Than you are in a SES Sandbox.

You need your account be removed from the Amazon SES sandbox

read more here

https://docs.aws.amazon.com/ses/latest/DeveloperGuide/request-production-access.html

Upvotes: 1

Mircea Soaica
Mircea Soaica

Reputation: 2817

You can only send emails after verifying the email address (the email in the FROM field). This is an anti spam / anti phishing measure.

http://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-email-addresses.html

Upvotes: 1

Related Questions