Intermittent outbound SMTP connectivity issue (Errno 101: Network is unreachable) from Railway web service
rogerppacheco
HOBBYOP

a month ago

Hello Railway Support Team,

I am experiencing intermittent outbound network issues from my Railway service when sending emails via SMTP.

Project/Environment/Service

  • Project: melodious-hope
  • Environment: production
  • Service: web
  • Deployment ID (example where error occurred): e3648a95-d2ec-4c5f-ac5f-a6297dc9e5bb

Issue Our Django app fails to connect to Gmail SMTP from the running container with:

OSError: [Errno 101] Network is unreachable

This happens in production during a password reset email flow.

Relevant traceback/log timestamp

  • Timestamp: 2026-04-27T02:15:41Z
  • Stack points to Python smtplib.connect() and Django SMTP backend:
    • django/core/mail/backends/smtp.py, line 128
    • smtplib.py, line 341 (connect)
    • smtplib.py, line 312 (_get_socket)

SMTP target

  • Host: smtp.gmail.com
  • Port: 587
  • TLS: STARTTLS

Important context

  • App SMTP environment variables are correctly loaded in runtime (EMAIL_HOST, EMAIL_PORT, EMAIL_USE_TLS, EMAIL_HOST_USER, EMAIL_HOST_PASSWORD).
  • A manual test via railway run succeeded at least once (send_mail returned success), but production requests still intermittently fail with Errno 101.

Could you please check whether there is any egress/network restriction or instability from this service/replica to smtp.gmail.com:587?

If needed, I can provide full CSV logs and exact request times.

Thank you!

Solved

1 Replies

Railway
BOT

a month ago

Your workspace is on the Hobby plan, which does not support outbound SMTP. This is why your Django app gets Errno 101: Network is unreachable when connecting to smtp.gmail.com:587. The railway run command succeeded because it executes from your local machine, not from Railway's infrastructure, so it bypasses this restriction. For sending emails on the Hobby plan, you'll need to use a transactional email service with an HTTPS API such as Resend, SendGrid, Mailgun, or Postmark. More details are in our outbound networking docs.


Status changed to Awaiting User Response Railway 26 days ago


Railway
BOT

19 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 19 days ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...