Connection could not be established with host smtp.mailtrap.io [Connection refused #111]

Published 1 week ago by ekpono

Connection could not be established with host smtp.mailtrap.io [Connection refused #111] on live server. Here is my credentials

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=my-username
MAIL_PASSWORD=mypassword

Please help out it is urgent. Have cleared config. Have also optimize:clear

Best Answer (As Selected By ekpono)
Cronix

Did you check whether you're behind a firewall that's blocking outgoing port 2525?

Cronix
Cronix
1 week ago (794,690 XP)

That works for me. The only addition I have is MAIL_ENCRYPTION=null

You'd also need to make sure that outgoing port 2525 is allowed through any firewalls your server might be behind.

Not sure why you'd be using mailtrap in production though...

ekpono
ekpono
1 week ago (4,490 XP)

.env MAIL_ENCRYPTION=NULL

I want to receive the mail in [email protected]. What other options do I have?

Cronix
Cronix
1 week ago (794,690 XP)

Did you check whether you're behind a firewall that's blocking outgoing port 2525?

D9705996
D9705996
1 week ago (127,290 XP)

you can test if the port is available through your firewall using nmap from the command line on your server

 nmap -Pn -pT:2525 my-domain-name.com

Starting Nmap 7.01 ( https://nmap.org ) at 2018-10-11 18:56 BST
Nmap scan report for my-domain-name.com (52.55.164.156)
Host is up.
Other addresses for my-domain-name.com (not scanned): 52.5.251.20
rDNS record for 52.55.164.156: ec2-52-55-164-156.compute-1.amazonaws.com
PORT     STATE    SERVICE
2525/tcp filtered ms-v-worlds

Nmap done: 1 IP address (1 host up) scanned in 8.16 seconds

You need to see the STATE as open and not filtered or closed.

Obviously replace the my-domain-name.com with your real domain name

ekpono
ekpono
1 week ago (4,490 XP)

On ssh it is am having $ nmap -Pn -Pt:2525 koboaccountant.com -bash: nmap: command not found

Cronix
Cronix
1 week ago (794,690 XP)

You just need to install it. How to do that depends on the os you're using, but here's how on CentOS/Debian/Ubuntu. Most others will also use one of those depending on what linux it was based off of:

  1. CentOS: yum install nmap
  2. Debian: apt-get install nmap
  3. Ubuntu: sudo apt-get install nmap
ekpono
ekpono
1 week ago (4,490 XP)

I am using Windows..

ekpono
ekpono
1 week ago (4,490 XP)

I am getting command not found in all the 3 commands

D9705996
D9705996
1 week ago (127,290 XP)

Download and install https://nmap.org/dist/nmap-7.70-setup.exe and try again

Cronix
Cronix
1 week ago (794,690 XP)

Oh, if you're on windows, just temporarily disable the firewall and try your code again. If it works, then just create a new rule and allow port 2525 through.

D9705996
D9705996
1 week ago (127,290 XP)

Just remember you must run the nmap command on the same server/pc as your laravel application

ekpono
ekpono
1 week ago (4,490 XP)

Still unable to send through mailtrap. Have installed nmap but in my command line, it doesn't recognize it.

D9705996
D9705996
1 week ago (127,290 XP)

@ekpono - did you reboot after the install. It's required.

Cronix
Cronix
1 week ago (794,690 XP)

I want to receive the mail in [email protected]

You might also want to clarify that statement.

Mailtrap is for testing only. You can't send mail to a specific domain, like "my-domain-name.com". All email sent from your app will go to mailtrap, and you'll need to login to mailtrap to see them. It's not a real full blown email server. You can't use 3rd party tools to access it (like Thunderbird, Apple Mail, the email app on your phone, etc). It won't alert you when you receive a new email. You can't send emails from it. You can only receive emails, and you have to manually login to see if there are any. It doesn't sound like this is what you want to do from your quote? I'd hate to see you spending a bunch of time getting mailtrap to work if it won't actually do what you need it to do. It's just meant to test whether your app can send email out specifically to your mailtrap account (not some other domain). Nothing more.

ekpono
ekpono
1 week ago (4,490 XP)

@D705996

Starting Nmap 7.70 ( https://nmap.org ) at 2018-10-11 22:09 W. Central Africa Standard Time
Nmap scan report for www.koboaccountant.com (199.188.200.47)
Host is up.
rDNS record for 199.188.200.47: server239-2.web-hosting.com

PORT     STATE    SERVICE
2525/tcp filtered ms-v-worlds

Nmap done: 1 IP address (1 host up) scanned in 16.55 seconds

Please sign in or create an account to participate in this conversation.