SMTP Verification Fails in Docker with "Connection refused (os error 111)"

Author: Nithin6524Created Mar 22, 2026Updated May 11, 2026

SMTP Verification Fails in Docker with "Connection refused (os error 111)"

Description

When running the backend server inside a Docker container, SMTP-based email verification fails with the following error:

"message": "Connection refused (os error 111)"

This occurs while attempting to verify email reachability.


Steps to Reproduce

  1. Run the backend service inside a Docker container
  2. Trigger email validation for a Gmail address (e.g., [email protected])
  3. Observe the validation response

Expected Behavior

  • SMTP verification should successfully connect to the recipient mail server
  • is_reachable should return a definitive value (true or false)

Actual Behavior

  • SMTP connection fails with:

    Connection refused (os error 111)
  • is_reachable is returned as "unknown"


Relevant Output

json
"smtp": {
  "error": {
    "type": "IOError",
    "message": "Connection refused (os error 111)"
  }
}

Source: reacherhq/check-if-email-exists