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

Rretzko's avatar
Level 15

Laravel Mail going to Log instead of SES.

Hi Guys - Trying to figure out what's going wrong in my linkage to AWS SES that the Laravel Mail is sending the content to the log file instead of SES from my local maching.

I'm regularly up/downloading files via Amazon S3, so I know my credentials are in order and I know the Mail is working as it populates the log with the expected content, but I've included it below in case I've missed something important.

Your additional eyes are appreciated!

My configs/mail file:

<?php

return [

     'default' => env('ses', 'log'),
    'mailers' => [

        'smtp' => [
            'transport' => 'smtp',
            'url' => env('MAIL_URL'),
            'host' => env('MAIL_HOST', '127.0.0.1'),
            'port' => env('MAIL_PORT', 2525),
            'encryption' => env('MAIL_ENCRYPTION', 'tls'),
            'username' => env('MAIL_USERNAME'),
            'password' => env('MAIL_PASSWORD'),
            'timeout' => null,
            'local_domain' => env('MAIL_EHLO_DOMAIN'),
        ],

        'ses' => [
            'transport' => 'ses',
        ],

        'postmark' => [
            'transport' => 'postmark',
     ],

        'sendmail' => [
            'transport' => 'sendmail',
            'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
        ],

        'log' => [
            'transport' => 'log',
            'channel' => env('MAIL_LOG_CHANNEL'),
        ],

        'array' => [
            'transport' => 'array',
        ],

        'failover' => [
            'transport' => 'failover',
            'mailers' => [
                'smtp',
                'log',
            ],
        ],

        'roundrobin' => [
            'transport' => 'roundrobin',
            'mailers' => [
                'ses',
                'postmark',
            ],
        ],

    ],

    'from' => [
        'address' => env('MAIL_FROM_ADDRESS', '[email protected]'),
        'name' => env('MAIL_FROM_NAME', 'Rick Retzko'),
    ],

];

The Mail file is:

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Address;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;

class RequestInvitationToEventMail extends Mailable
{
    use Queueable, SerializesModels;

  
    public function __construct()
    {
        //
    }

    public function envelope(): Envelope
    {
        return new Envelope(
            from: new Address('[email protected]', 'Rick Retzko'),
            subject: 'Request Invitation To Event Mail',
        );
    }

    public function content(): Content
    {
        return new Content(
            view: 'mail.requestInvitationToEvent',
            with: [
                'name' => 'Name',
                'schoolVo' => 'schoolVo',
                'workEmail' => '[email protected]',
                'verificationUrl' => '12345',
            ],
        );
    }

    public function attachments(): array
    {
        return [];
    }
}

My .env file has the following settings:

BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database

MAIL_MAILER=ses
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=***************************************
AWS_SECRET_ACCESS_KEY=********************************
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=production-bucket
AWS_USE_PATH_STYLE_ENDPOINT=false

Thanks for your help!

0 likes
4 replies
tykus's avatar
tykus
Best Answer
Level 104

The env key is MAIL_MAILER, not ses; and, since there is no ses key, the env() function returns the default 'log' instead

// config/mail.php
'default' => env('MAIL_MAILER', 'log'),
martinbean's avatar

@rretzko Why have you changed this line?

'default' => env('ses', 'log'),

The first argument of the env helper is the key, not a value. So put it back to MAIL_MAILER like it was before, and then actually change that environment variable.

You shouldn’t be touching and changing your config files at all.

Rretzko's avatar
Level 15

Thanks, guys. I changed the configs/mail back to 'MAIL_MAILER' as recommended and after resetting the env file and restarting the server, it's working on local now as expected. Thanks for the help!

1 like
LaryAI's avatar
Level 58

It looks like the issue is with the default mailer configuration in your config/mail.php file. The default key should be set to 'ses' instead of 'log'. This is why your emails are being logged instead of being sent via AWS SES.

Here's the corrected config/mail.php file:

Additionally, ensure that your .env file has the correct MAIL_MAILER setting:

MAIL_MAILER=ses
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=***************************************
AWS_SECRET_ACCESS_KEY=********************************
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=production-bucket
AWS_USE_PATH_STYLE_ENDPOINT=false

With these changes, Laravel should use AWS SES to send emails instead of logging them. Make sure to clear the configuration cache after making these changes:

php artisan config:cache

This should resolve the issue and ensure that your emails are sent via AWS SES.

Please or to participate in this conversation.