I’m trying to configure email sending using Mailgun on my server (let’s call it server1.mysite.com) but running into connection issues.
My Setup
I’m using this configuration for email delivery:
smtp.mailgun.org smtp --port=587 [email protected] --pass=MYPASSWORD
The Problem
This setup works perfectly on server2.mysite.com but fails completely on server1.mysite.com. When I test the connection:
Working server (server2.mysite.com):
$ telnet smtp.mailgun.org 587
Trying 52.38.21.43...
Connected to smtp.mailgun.org.
Escape character is '^]'.
220 mx01 ESMTP ready
Failing server (server1.mysite.com):
$ telnet smtp.mailgun.org 587
Trying 52.38.21.43...
[connection hangs here]
The connection just hangs and never establishes. Could Mailgun be blocking my server’s IP address? Is this something that gets resolved automatically or do I need to contact support? What else could cause this behavior?
yep, sounds like a firewall prob on server1. make sure port 587 ain’t blocked - hosting services usually do that. try telnet google.com 587 to see if it’s just Mailgun or all SMTP stuff that’s causing issues.
Yeah, this is definitely IP blocking. Mailgun has strict reputation filters and will block IPs that look suspicious or come from sketchy network ranges. I ran into the exact same thing when I switched hosting providers - same config worked perfectly on one server but totally failed on another. That hanging telnet test? Classic IP-level block, not an auth problem. You’ll need to contact Mailgun support for IP whitelisting. They’ll want justification for your use case and domain verification. Took about 48 hours when it happened to me. Also check if your host has SMTP restrictions, but since it’s connecting to the same IP, it’s probably blocked on Mailgun’s side.
Had the same problem last month. Wasn’t actually Mailgun - turned out my network was blocking SMTP traffic entirely. Before you contact support, test SendGrid or Amazon SES from server1. That’ll tell you if it’s just Mailgun or all SMTP providers.
Also check your reverse DNS setup. No PTR records? Most mail providers will auto-flag you. If other SMTP services work fine, then yeah, Mailgun’s blocking your IP.
In my case, the datacenter’s IP range got blacklisted because spammers used it before. Mailgun support helped out, but they wanted proof I was legit - had to verify domain ownership and everything.