Railway

Deploy Mini Mailer

Local SMTP to HTTP Proxy for Mailgun, Postmark, and MailerSend

Deploy Mini Mailer

Just deployed

Deploy and Host Mini Mailer on Railway

Mini Mailer is a simple SMTP server that forwards mail over HTTP to Mailgun, Postmark, or MailerSend. For use as an SMTP gateway to allow applications that use SMTP to send emails via an HTTP endpoint when outbound SMTP is restricted.

Mini Mailer does not currently support attachments and is designed to run on an internal network only (e.g. mini-mailer.railway.internal), as it does not use TLS.

About Hosting Mini Mailer

Mini Mailer is a simple serverless application that creates an SMTP server on ports 25, 2525, and 587, and a HTTP server on port 80 used for health checks. The SMTP server listens for incoming SMTP connections and forwards the email to the HTTP endpoint.

Mini Mailer requires no configuration or dependencies and will automatically detect the email service provider based on the API token or SMTP username.

To send emails, configure your application to send email with:

  • Host: your Mini Mailer host (e.g. mini-mailer.railway.internal).
  • Port: 25, 2525, or 587.
  • Username: For Mailgun, this is the domain name (e.g. mg.yourdomain.com). For Postmark and MailerSend, this can be any username.
  • Password: Your email service provider's API key or token.

Username Format

You can specify any username and Mini Mailer will attempt to identify the provider based on the API key. To manually set the provider, specify either mailgun, mailgun-eu, postmark, or mailersend as the username (or local part of the username).

For example, to send to Postmark, you could use the username postmark, or [email protected].

For Mailgun, you must specify the sending domain in the username, either like sendingdomain.com or [email protected] where sendingdomain.com is the domain configured for your Mailgun API key.

Common Use Cases

  • Relaying SMTP traffic to HTTP endpoints
  • Sending SMTP email when outbound SMTP is restricted

API Keys and Endpoints

Mailgun

Create a new Domain Sending Key for your domain. Use your domain (or any email address on the sending domain) as the SMTP username, and the API key as the SMTP password.

Internally, Mini Mailer will use the API endpoint https://api.mailgun.net/v3/{domain}/messages.mime to send emails.

Postmark

Create a new Server API Token for your server. Use any username as the SMTP username, and the API token as the SMTP password.

Internally, Mini Mailer will use the API endpoint https://api.postmarkapp.com/email to send emails.

MailerSend

Create a new API Token for your account. Use any username as the SMTP username, and the API token as the SMTP password.

Internally, Mini Mailer will use the API endpoint https://api.mailersend.com/v1/email to send emails.

Dependencies for Mini Mailer Hosting

One of the following email service providers:

  • Mailgun
  • Postmark
  • MailerSend

Deployment Dependencies

Environment Variables:

  • PORT: Health check port (80)
  • MAILGUN_EU: If set to 1, will route Mailgun emails to api.eu.mailgun.net.

Why Deploy Mini Mailer on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Mini Mailer on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


Template Content

More templates in this category

View Template
Foundry Virtual Tabletop
A Self-Hosted & Modern Roleplaying Platform

Lucas
View Template
Letta Code Remote
Run a Letta Code agent 24/7. No inbound ports, just deploy.

Letta
View Template
(v1) Simple Medusa Backend
Deploy an ecommerce backend and admin using Medusa

Shahed Nasser