Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

nad27's avatar
Level 4

Spark & Amazon SES not setting from field

I'm attempting to integrate Spark with Amazon SES for sending of emails. I can tell it's working if I use Mail::raw, etc. The problem I have is that Spark is sending emails but doesn't appear to be setting the from email address. Amazon SES doesn't like that. For instance, the password reset email and "contact us" emails aren't setting the "from" email address.

In the log I see:

at AwsClient->__call('sendRawEmail', array(array('Source' => null, 'RawMessage' => array('Data' => 'Message-ID: <[email protected]> Date: Thu, 16 Jun 2016 15:05:24 +0000 From: To: [email protected] MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable emails.welcome')))) in SesTransport.php line 38

Notice the "Source" being set to null. This causes Amazon to throw back an InvalidParameterValue (client): Illegal address error.

I'm trying to track this down...just curious if others have hit the same snag & have a solution.

0 likes
4 replies
jmny's avatar
jmny
Best Answer
Level 9

Sure, just set it in config/mail.php

'from' => ['address' => null, 'name' => null],
1 like
freshyseth's avatar

So, I'm getting the following error and the config isn't my problem. Here's my config/mail.php:

'from' => [
        'address' => env('MAIL_FROM_ADDRESS', '[email protected]'),
        'name' => env('MAIL_FROM_NAME', 'Christian Men\'s Network'),
    ],

And my config/services.php:

'ses' => [
        'key'    => env('SES_KEY'),
        'secret' => env('SES_SECRET'),
        'region' => 'us-west-2',
    ],

The .env variables are correct on my production server.

My driver is set as:

'driver' => env('MAIL_DRIVER', 'ses'),

The error that I'm getting is:

production.ERROR: Error executing "SendRawEmail" on "https://email.us-west-2.amazonaws.com"; 
AWS HTTP error: Client error: `POST https://email.us-west-2.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-WEST-2: [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-WEST-2: [email protected]</Message>   
    </Error>   
    <RequestId>741b0919-1dcd-11e8-8c5a-6f692aebc634</RequestId> 
</ErrorResponse>
freshyseth's avatar

Turns out that the problem was I had not moved out of the SES sandbox. That wasn't apparent to me and after doing so it upped my sending limit and allows non-verified emails to be delivered to. When still in the sandbox you can only send from AND to verified email addresses. Problem solved.

Please or to participate in this conversation.