SMTP integration
Use any SMTP client, application or device. Copy the connection values from your dashboard and add TLS.
Connection details
Always use an encrypted connection. Authenticate with your SMTP username and an API key as the password. Copy the exact host and username from the SMTP page of your dashboard; the values below show the shape.
Host: YOUR_SMTP_HOST Port: 587 (STARTTLS) or 465 (implicit TLS) Username: YOUR_SMTP_USERNAME Password: YOUR_API_KEY
Which port to use
Port 587 with STARTTLS is the standard submission port and the best default. Port 465 uses TLS from the first byte and suits clients that expect it. Avoid port 25 for submission: it is meant for server-to-server mail and many hosting providers block it.
Test from the command line
Confirm authentication before wiring up your application. swaks sends a test message; openssl shows the TLS handshake if something fails.
swaks --to [email protected] --from [email protected] \ --server YOUR_SMTP_HOST:587 --tls \ --auth LOGIN --auth-user YOUR_SMTP_USERNAME openssl s_client -starttls smtp -connect YOUR_SMTP_HOST:587
Example: Node.js (Nodemailer)
Nodemailer works with any SMTP service. Keep credentials in environment variables.
const nodemailer = require("nodemailer");
const transport = nodemailer.createTransport({
host: process.env.SMTP_HOST,
port: 587,
secure: false, // STARTTLS
auth: { user: process.env.SMTP_USER, pass: process.env.MIGOSMTP_KEY },
});
await transport.sendMail({ from, to, subject, text });Example: Python (smtplib)
The standard library is enough for a simple send.
import os, smtplib from email.message import EmailMessage msg = EmailMessage() msg["From"], msg["To"], msg["Subject"] = "[email protected]", "[email protected]", "Hello" msg.set_content("It works.") with smtplib.SMTP(os.environ["SMTP_HOST"], 587) as s: s.starttls() s.login(os.environ["SMTP_USER"], os.environ["MIGOSMTP_KEY"]) s.send_message(msg)
Headers worth setting
Set a Reply-To if replies should go somewhere other than the from address. For bulk or marketing mail add a List-Unsubscribe header, which mailbox providers look for. Use a from address on a domain you have verified, or the message may be rejected.
Delivery results
SMTP only tells you the message was accepted. To learn whether it was delivered, bounced or reported as spam, use webhooks or the activity view in the dashboard.