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

2

7

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.

Modena answered 19/2, 2016 at 17:51 Comment(2)
A lot of hosts, isps, etc. block port 25. Have you tried port 465 or 2525?Counterwork
yes i did use port 465 and 2525, but still doesn't work.Modena
P
6

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]

Peaceful answered 21/11, 2016 at 15:53 Comment(0)
O
3

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
Oxysalt answered 6/5, 2021 at 22:48 Comment(1)
did not worked for meSlicker

© 2022 - 2024 — McMap. All rights reserved.