10

I am using mail trap to test my emails and I am getting the error stated in above in the title.

This is the env files that I have

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=465
MAIL_USERNAME=XXXXXddda513d4
MAIL_PASSWORD=da084XXXXXXbbe
MAIL_ENCRYPTION=tls

I can not find much on this. What I found was to clear your cache and I did it wand saw no change.

John Freedom
  • 471
  • 4
  • 6
  • 11

5 Answers5

24
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=587
MAIL_USERNAME=*******
MAIL_PASSWORD=********
MAIL_FROM_ADDRESS=from@example.com
MAIL_FROM_NAME=Example

switch the MAIL_PORT between (25 or 465 or 587 or 2525)

icharis
  • 261
  • 2
  • 3
5

use port 25 and mail encryption is empty like

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=25
MAIL_USERNAME=XXXXXddda513d4
MAIL_PASSWORD=da084XXXXXXbbe
MAIL_ENCRYPTION=
0

The following settings could do the trick:

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=465
MAIL_USERNAME=xxx
MAIL_PASSWORD=yyy

Remove the MAIL_ENCRYPTION line entirely. It's also worth checking that the ports are open on your firewall (if you have one), or check that you are able to connect to port 465.

Niraj Shah
  • 15,087
  • 3
  • 41
  • 60
0

could you please try this code ?

'stream' => [
      'ssl' => [
          'allow_self_signed' => true,
          'verify_peer' => false,
          'verify_peer_name' => false,
      ],
    ],

at the end of your config/mail.php file. it might be helpful

Ali Raza
  • 183
  • 14
0

This problem occurs when some changes have been made to files, specifically in the .env file

Clear cache using artisan command

php artisan cache:clear

Clear config

php artisan config:clear

Restart your server

sudo service apache2 restart

Sometimes you also need to clear the browser's cache & cookies.

Fariman Kashani
  • 856
  • 1
  • 16
  • 29