Send email over SMTP
Use the SMTP relay when your app, framework or plugin can only send email over SMTP, or when you are moving from another provider and want to change settings, not code. Mail sent over SMTP follows the same rules as the API: verified senders, suppressions, sending limits and delivery events all apply.
The SMTP relay is included on paid plans.
Connection settings
| Setting | Value |
|---|---|
| Host | smtp.mailhuset.com |
| Port | 587 with STARTTLS (recommended), or 465 with TLS from the start |
| Encryption | Required. Login is refused until the connection is encrypted. |
| Username | Your SMTP credential's username |
| Password | Your SMTP credential's password |
There is no port 25. Mailhuset is a submission service for your own mail, not an open relay.
Create a credential
In the dashboard, open SMTP relay and choose New credential. Give it a name you will recognise, such as the app or server that uses it. You get a username and a password; the password is shown once, so copy it straight into your app's settings.
A credential can only relay mail over SMTP. It cannot call the API, and an API key cannot log in to the relay. Create one credential per app or server, so you can revoke one without breaking the others.
Example: Nodemailer
import nodemailer from "nodemailer";
const transport = nodemailer.createTransport({
host: "smtp.mailhuset.com",
port: 587,
requireTLS: true,
auth: { user: process.env.SMTP_USERNAME, pass: process.env.SMTP_PASSWORD },
});
await transport.sendMail({
from: "Acme <hello@yourdomain.com>",
to: "customer@example.com",
subject: "Your receipt",
text: "Thanks for your order.",
});The dashboard's SMTP relay page also has ready-made settings for Laravel, Django and WordPress.
How messages are handled
- Sender. The
Fromaddress must be on a verified domain or be a verified sender, or the message is refused with550 5.7.1. - Recipients. Mail goes to the recipients your client gives in the SMTP envelope. Anyone not shown in the
ToorCcheaders is sent as bcc. Up to 50 recipients per message. - Streams. Mail goes on the transactional stream unless you add the header
X-Mailhuset-Streamwith another stream's ID. - Attachments and inline images are kept, up to 10 MB of attachments per message.
- Retries. If your client resends a message with the same
Message-ID, it is not sent twice.
Replies from the relay
| Reply | Meaning | What to do |
|---|---|---|
250 | Accepted and queued. The reply includes the message ID, which you can find in Activity. | Nothing. |
451, 452 | A limit was reached for now (rate, hourly limit, or recipient count). | Your client retries later; send fewer at once. |
535 | Login failed. | Check the username and password, and that the credential is not revoked. |
550 5.7.1 | The sender is not verified, or sending is paused or not approved. | Verify the domain or sender, or check your account status. |
552 | The message is too large, or your plan's limit is reached. | Send smaller messages, or upgrade. |
Repeated failed logins from one address are blocked for a while, so a misconfigured app can lock itself out. Fix the credential and wait 15 minutes.
Need help? Email support@mailhuset.com.