Aleks Per
Aleks Per

Reputation: 1639

Laravel 5.1 - Swift_TransportException - cant send emails

  1. at .env file I have this code:

    MAIL_DRIVER=smtp

    MAIL_HOST=smtp.sendgrid.net
    
    MAIL_PORT=587
    
    [email protected]
    
    MAIL_PASSWORD=hggahsd666
    
    MAIL_ENCRYPTION=tls
    

and I get this screen:

enter image description here

I also try:

MAIL_DRIVER=smtp
    MAIL_HOST=smtp.sendgrid.net
    MAIL_PORT=465
    [email protected]
    MAIL_PASSWORD=hggahsd666
    MAIL_ENCRYPTION=ssl

but dont works again...

I also try to change settings into config/mail.php to be the same as on .env file but dont work and at the end I try command

php artisan cache:clear

Is possible problem cause redirection to secure domain https://asdasd.com/sendEmail ?

Upvotes: 1

Views: 718

Answers (1)

Nil
Nil

Reputation: 523

keep mail.php like this way

<?php
return [
    'driver' => env('MAIL_DRIVER', 'smtp'),
    'host' => env('MAIL_HOST', 'smtp.gmail.com'),
    'port' => env('MAIL_PORT', 587),
    'from' => [
        'address' => '[email protected]',
        'name' => 'Example',
    ],
    'encryption' => env('MAIL_ENCRYPTION', 'tls'),
    'username' => env('MAIL_USERNAME'),
    'password' => env('MAIL_PASSWORD'),
    'sendmail' => '/usr/sbin/sendmail -bs',

];

Then cross check all your credentials in .env file, If still not work then go to your email account and change app settings to allow less secure apps

Upvotes: 1

Related Questions