Get started / Quickstart
Quickstart
Send your first test email to Mailtarn in about five minutes.
Create an inbox
In app.mailtarn.com, open Inboxes and choose New inbox. Name it after the environment that will send to it, such as staging.
Mailtarn shows the inbox’s SMTP username and password. The password is shown only once, so copy both into your secrets manager now.
There’s no public sign-up yet. Join the waitlist and we’ll email you when accounts open.
Point your app at Mailtarn
| Host | smtp.mailtarn.com |
|---|---|
| Port | 587 with STARTTLS (recommended), or 465 with TLS |
| Username | Your inbox’s SMTP username |
| Password | Your inbox’s SMTP password |
mailer.js
import nodemailer from 'nodemailer';
export const transport = nodemailer.createTransport({
host: 'smtp.mailtarn.com',
port: 587, // STARTTLS. For 465, set secure: true
secure: false,
auth: {
user: process.env.MAILTARN_USER,
pass: process.env.MAILTARN_PASS,
},
});.env
MAIL_MAILER=smtp MAIL_HOST=smtp.mailtarn.com MAIL_PORT=587 MAIL_USERNAME=your-inbox-username MAIL_PASSWORD=your-inbox-password MAIL_FROM_ADDRESS=app@example.com
settings.py
import os EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend" EMAIL_HOST = "smtp.mailtarn.com" EMAIL_PORT = 587 EMAIL_USE_TLS = True EMAIL_HOST_USER = os.environ["MAILTARN_USER"] EMAIL_HOST_PASSWORD = os.environ["MAILTARN_PASS"]
config/environments/staging.rb
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: "smtp.mailtarn.com",
port: 587,
user_name: ENV["MAILTARN_USER"],
password: ENV["MAILTARN_PASS"],
authentication: :plain,
enable_starttls_auto: true
}terminal
swaks --server smtp.mailtarn.com:587 --tls \ --auth-user "$MAILTARN_USER" --auth-password "$MAILTARN_PASS" \ --from app@example.com --to test@example.com \ --header "Subject: Hello from Mailtarn"
Use a different inbox for each environment. If one set of credentials leaks, you rotate one inbox, not all of them.
Send a test email
Trigger any email in your app: sign up a test user or request a password reset. Within a few seconds it appears in your Mailtarn inbox, where you can check the HTML, plain text, headers and attachments.
Nothing is delivered to the address in the To field.
Troubleshooting
- The connection times out
- Some networks block outbound port 587. Try port 465 with TLS instead.
- Authentication fails
- Check you’re using the inbox’s SMTP credentials, not your account login. If you rotated the password more than 24 hours ago, the old one has stopped working.
- TLS or certificate errors on port 465
- Port 465 expects TLS from the first byte. In Nodemailer set
secure: true; most other libraries call this SSL or implicit TLS. - The password is refused on port 587
- Mailtarn accepts the password only after STARTTLS. Make sure your library upgrades the connection before it logs in (in Nodemailer, don’t set
ignoreTLS). - The message is rejected as too large
- Each inbox has a size limit per message, attachments included: 10 MB unless it was changed. The inbox’s settings show its limit.