Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix connection not established on smtp mailtrap.io in centos

I have already set up my config in env for my mail server

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=25
MAIL_USERNAME=xxxxxxxx
MAIL_PASSWORD=xxxxxxxx
MAIL_ENCRYPTION=null

It works fine in my local server. But when I test it on my production server, it doesn't work any more. I also tried modifying my iptables to allow the port connections

# Generated by iptables-save v1.4.18 on Fri Feb 19 14:47:25 2016
*filter
:INPUT ACCEPT [72:5432]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [53:7392]
-A INPUT -p tcp -m tcp --dport 25 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 110 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 995 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 143 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 993 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 1080 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 1025 -j ACCEPT
COMMIT

But to no good. It still says Connection not established whenever I try to send a test email.

Then I tried to telnet and it timeouts

[root@root laravel5]# telnet mailtrap.io 25
Trying 52.20.34.166...
telnet: connect to address 52.20.34.166: Connection timed out
Trying 52.22.93.185...
telnet: connect to address 52.22.93.185: Connection timed out
Trying 52.5.202.66...
telnet: connect to address 52.5.202.66: Connection timed out

What could cause this? Can anybody help me on this? Thank you sooo much.

like image 455
TheGPWorx Avatar asked Feb 19 '16 17:02

TheGPWorx


People also ask

Why is Mailtrap not working?

Try to use another SMTP port: 2525, 465, or 25. In most cases, the issue is related to the SMTP port being blocked by the firewall. If none of these ports work, try connecting with a different machine, location, ISP, or use a VPN. This will help identify the route affected by the issue.

What is SMTP Mailtrap io?

Mailtrap.io represents a cloud-based email testing service with a fake SMTP server under the hood. You send test emails from your app and Mailtrap catches and puts them into a virtual inbox. You can be sure that none of the emails will get to a real user.


2 Answers

You need to use port 2525 as all other mailtrap.io config codes suggest.

SMTP
Host: mailtrap.io or smtp.mailtrap.io (MX)
Port: 25 or 465 or 2525

Also try to add subdomain:

smtp.mailtrap.io

If it does not work, write to [email protected]

like image 146
Yevgen Tsvetukhin Avatar answered Oct 28 '22 07:10

Yevgen Tsvetukhin


I changed my config.port 2525 to 25 and it works


MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=25
MAIL_USERNAME=222222eferfeferfe
MAIL_PASSWORD=erferferferferfef
MAIL_ENCRYPTION=null
like image 33
saber tabatabaee yazdi Avatar answered Oct 28 '22 06:10

saber tabatabaee yazdi