lundi 16 janvier 2017

Laravel forgot password emails not being sent

I have an extremely odd issue with Laravel emails.

Generally speaking I can send emails fine like so:

Mail::send('foo', $templateData,
    function (Message $message) use ($name, $email) {
        $message
            ->from('admin@example.com', 'My Example Company')
            ->to($email, $name)
            ->subject('Blah');
    }
);

However, when trying to reset password, an email is not sent on my production server, despite acting like it has sent (i.e. no exceptions!). It is however sent when using mailtrap.io.

This is how my .env file looks like:

APP_ENV=prod
APP_KEY=XXXX
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://example.co.uk

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=XXX
DB_USERNAME=XXX
DB_PASSWORD=XXX

CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=XXX
MAIL_PORT=XXX
MAIL_USERNAME=XXX
MAIL_PASSWORD=XXX
MAIL_ENCRYPTION=ssl
MAIL_FROM=admin@example.com
MAIL_FROM_NAME="My Example Company"

GOOGLE_API_KEY=XXX

I also tried:

 composer dump-autoload
 php artisan clear-compiled
 php artisan config:clear

But to no avail.

Interestingly, when I use Mailer as opposed to the Mail facade, the email is again not sent with no exceptions raised.

public function foo(Illuminate\Mail\Mailer $mailer)
{
    $mailer->send('ViewName', [],
        function (Message $message) {
            $message
                ->from('admin@example.com', 'My Example Company')
                ->to('you@example.com', 'John Smith')
                ->subject('Blah');
        }
    );
}



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2jAFAMT
via IFTTT

Aucun commentaire:

Enregistrer un commentaire