16 days ago
Hello Railway Support Team,
I am hosting a FastAPI backend application on Railway.
My application sends OTP emails using Gmail SMTP.
The exact same code works perfectly on my local machine.
However, after deploying to Railway, SMTP connections always time out.
I performed the following tests:
- HTTPS connectivity works.
requests.get("https://google.com") returns HTTP 200.
- DNS resolution works.
socket.gethostbyname("smtp.gmail.com") successfully resolves the IP address.
- SMTP connections fail.
socket.create_connection(("smtp.gmail.com", 587), timeout=10) -> TimeoutError
socket.create_connection(("smtp.gmail.com", 465), timeout=10) -> TimeoutError
socket.create_connection(("smtp.office365.com", 587), timeout=10) -> TimeoutError
Application log:
Error sending email: Timed out connecting to smtp.gmail.com on port 587
SMTP Configuration:
Host: smtp.gmail.com
Port: 587
Workspace:
Trial Workspace
I also found another Railway community thread where another user is experiencing the exact same issue with SMTP outbound connections timing out.
Could you please check:
-
Are outbound SMTP connections currently restricted for my workspace or project?
-
Do SMTP ports (465 and 587) need to be manually enabled?
-
Is there any firewall or network policy blocking outbound SMTP traffic for my deployment?
If any changes are required from your side, could you please enable outbound SMTP access for my project?
Thank you.
5 Replies
16 days ago
Outbound SMTP is only available on the Pro plan and above, while Free, Trial, and Hobby plans have SMTP disabled. For sending emails from your application, please use a dedicated email service that provides HTTPS APIs. More information can be found in our documentation: Outbound Networking
Status changed to Awaiting User Response Railway • 16 days ago
Railway
Outbound SMTP is only available on the Pro plan and above, while Free, Trial, and Hobby plans have SMTP disabled. For sending emails from your application, please use a dedicated email service that provides HTTPS APIs. More information can be found in our documentation: [Outbound Networking](https://docs.railway.com/reference/outbound-networking)
16 days ago
Thank you.
Could you please confirm whether upgrading to the Pro plan will enable outbound SMTP connections immediately, or is any additional approval or configuration required?
I specifically need to use Gmail SMTP on ports 587/465 for my production application.
Status changed to Awaiting Railway Response Railway • 16 days ago
16 days ago
Yes, upgrading to Pro enables outbound SMTP immediately with no additional approval or configuration required. The only step after upgrading is to redeploy your service so the new network policy takes effect. Gmail SMTP on ports 587 and 465 will work once that redeploy completes. If you run into any issues after upgrading, refer to Debugging SMTP issues for troubleshooting steps.
Status changed to Awaiting User Response Railway • 16 days ago
Railway
Yes, upgrading to Pro enables outbound SMTP immediately with no additional approval or configuration required. The only step after upgrading is to redeploy your service so the new network policy takes effect. Gmail SMTP on ports 587 and 465 will work once that redeploy completes. If you run into any issues after upgrading, refer to [Debugging SMTP issues](https://docs.railway.com/reference/outbound-networking#debugging-smtp-issues) for troubleshooting steps.
16 days ago
Thank you for the clarification.
I understand that outbound SMTP is only available on the Pro plan.
If I use an email service that sends emails through HTTPS APIs instead of SMTP (for example, Resend API), will it work on Trial and Hobby workspaces?
My application sends OTP emails, password reset emails, and other notification emails.
Can you please confirm that outbound HTTPS API requests to services like Resend are supported on Trial and Hobby plans without requiring a Pro upgrade?
Thank you.
Status changed to Awaiting Railway Response Railway • 16 days ago
16 days ago
Yes, outbound HTTPS API requests work on all plans, including Trial and Hobby. Services like Resend, SendGrid, Mailgun, and Postmark all use HTTPS and will work without a Pro upgrade. Resend is our recommended approach for sending transactional emails like OTPs and password resets.
Status changed to Awaiting User Response Railway • 16 days ago
9 days ago
This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!
Status changed to Solved Railway • 9 days ago