Docs › Send email over SMTP

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

SettingValue
Hostsmtp.mailhuset.com
Port587 with STARTTLS (recommended), or 465 with TLS from the start
EncryptionRequired. Login is refused until the connection is encrypted.
UsernameYour SMTP credential's username
PasswordYour 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 From address must be on a verified domain or be a verified sender, or the message is refused with 550 5.7.1.
  • Recipients. Mail goes to the recipients your client gives in the SMTP envelope. Anyone not shown in the To or Cc headers is sent as bcc. Up to 50 recipients per message.
  • Streams. Mail goes on the transactional stream unless you add the header X-Mailhuset-Stream with 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

ReplyMeaningWhat to do
250Accepted and queued. The reply includes the message ID, which you can find in Activity.Nothing.
451, 452A limit was reached for now (rate, hourly limit, or recipient count).Your client retries later; send fewer at once.
535Login failed.Check the username and password, and that the credential is not revoked.
550 5.7.1The sender is not verified, or sending is paused or not approved.Verify the domain or sender, or check your account status.
552The 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.