---
title: "Deploy Mini Mailer"
description: "Local SMTP to HTTP Proxy for Mailgun, Postmark, and MailerSend"
category: "Other"
url: https://railway.com/deploy/mini-mailer
---

# Deploy Mini Mailer

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

**[Deploy Mini Mailer on Railway](https://railway.com/template/mini-mailer)**

- **Creator:** Nuovar
- **Category:** Other
- **Total deploys:** 9

## Template content

### Mini Mailer

- **Source:** NuovarDev/MiniMailer
- **Health check:** /health

## Documentation

# 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 `postmark@yourdomain.com`.

For Mailgun, you must specify the sending domain in the username, either like `sendingdomain.com` or `mailgun@sendingdomain.com` 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](https://help.mailgun.com/hc/en-us/articles/203380100-Where-can-I-find-my-API-keys-and-SMTP-credentials#h_01HVM3H8B5A6F5CN15XPPZRBNX) 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](https://postmarkapp.com/support/article/1008-what-are-the-account-and-server-api-tokens) 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](https://app.mailersend.com/api-tokens) 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.


## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/mini-mailer
