Fokrule
Fokrule

Reputation: 854

sending mail to mailtrap.io

I am using Laravel 5.1 I made a contact page in my application. So users can send an email. Here I have used mailtrap.io It works when I have created. I mean there was no problem to send mail to mailtrap.io

But today, when I was checking this again, It shows me this error.

Swift_TransportException in StreamBuffer.php line 268: Connection could not be established with host mailtrap.io [A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. #10060]

I have checked my .env file with mailtrap.io setting. everything is ok. Here is my .env file setting

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=25
MAIL_USERNAME=[username]
MAIL_PASSWORD=[password]
MAIL_ENCRYPTION=tls

Anyone please help me?

Upvotes: 3

Views: 12859

Answers (3)

Mohamed Raafat
Mohamed Raafat

Reputation: 377

try

MAIL_PORT=465

instead of

MAIL_PORT=2525

like this

MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=465
MAIL_USERNAME=your_username
MAIL_PASSWORD=your_password
MAIL_ENCRYPTION=tls

Upvotes: 0

Sumukh Bhat
Sumukh Bhat

Reputation: 1

Update your composer by giving

composer update

and run your application.

Upvotes: -1

Robert
Robert

Reputation: 5963

Probably you have issues with port 25 being blocked by your provider or host.

You can verify this using telnet:

telnet smtp.mailtrap.io 25

If you get no response or a timeout, you can not use port 25.

Mailtrap allows you to use 2 other ports, 2525 and 465.

You can verify with telnet if those ports are working.

telnet smtp.mailtrap.io 2525

If that connects properly, modify your .env file to use 2525.


If you are using php artisan serve instead of homestead or something else, be sure to restart after making changes to your .env.

Upvotes: 11

Related Questions