SMTP
Point an existing mail configuration at the relay. No code change.
If your application already speaks SMTP, this is the shortest path: change four settings and the same suppression rules, events and tracking apply as over the API.
Settings
| Setting | Value |
|---|---|
Host | smtp.mailgiri.com |
Port | 587 (STARTTLS) |
Username | Anything — it is ignored |
Password | Your API key (mg_live_… or mg_test_…) |
Encryption | STARTTLS, required |
The API key is the password and the username is ignored. That is deliberate: there is no second credential to rotate, and revoking a key closes this route at the same moment it closes the API.
Examples
import nodemailer from 'nodemailer';
const transport = nodemailer.createTransport({
host: 'smtp.mailgiri.com',
port: 587,
// STARTTLS on 587: begin in the clear, upgrade before AUTH.
secure: false,
requireTLS: true,
auth: {
// The username is ignored. The API key is the password.
user: 'apikey',
pass: 'mg_live_your_key',
},
});
await transport.sendMail({
from: 'hello@yourapp.com',
to: 'user@example.com',
subject: 'Welcome',
html: '<p>Glad you are here.</p>',
});
Test mode works here too
Authenticate with a test key and the relay runs the whole pipeline without sending real mail or spending quota — the same behaviour a test key gives over REST. It is the right credential for a staging environment.
If it will not connect
- 535 authentication failed — the password is the API key itself, not your dashboard password, and it must not be URL-encoded.
- Connection hangs — many hosting providers block outbound 587. Check with your provider before assuming the relay is down.
- Mail accepted but never arrives — check the suppression list first. A previously bounced address is dropped before it reaches the provider.
- 550 from address rejected — the
Fromdomain has to be one you have added and verified.