DocsSending
Send with SMTP
Connect a shop, forum or app that asks for an SMTP server.
Use SMTP when the software you run asks for a mail server instead of an API: online shops, forums, WordPress plugins, CRMs and most frameworks. You don't need to write any code.
Settings
- Server
smtp.zosmail.com- Port
- 587 or 2525
- Encryption
- STARTTLS, required (TLS 1.2 or newer)
- Username
zosmail- Password
- One of your API keys, starting with
zm_
Port 465 (implicit TLS) isn't offered; choose STARTTLS or "TLS" in your software. If port 587 is blocked by your host, try 2525. The sender address must be on one of your verified domains.
Example
Most software only needs the settings above. In code, it looks like this with Nodemailer:
import nodemailer from 'nodemailer';
const transport = nodemailer.createTransport({
host: 'smtp.zosmail.com',
port: 587,
secure: false,
requireTLS: true,
auth: { user: 'zosmail', pass: process.env.ZOSMAIL_API_KEY },
});
await transport.sendMail({
from: 'Acme <[email protected]>',
to: '[email protected]',
subject: 'Your sign-in code',
text: 'Your code is 123456.',
html: '<p>Your code is <strong>123456</strong>.</p>',
});
XenForo
- In the admin control panel, open Setup, Options, Email options.
- Set the default email address to one on your verified domain.
- Choose SMTP as the transport method, then enter the server, port 587, TLS encryption, the username and your API key as the password.
- Save, then use Tools, Test outbound email to send yourself a test.
What applies to SMTP email
- The same checks as the API: verified sender, complete company details, enough credits, the size limit and the recipient rules.
- Up to 50 recipients per message. Each one gets their own copy and appears separately in Reports.
- If any recipient fails the address checks, the whole message is refused with a
550reply that says why. Suppressed recipients are accepted and recorded as not sent, without using a credit. - The HTML and text together can be up to 50 KB. We use the first HTML part and the first plain-text part of your message.
- Attachments aren't supported yet. A message with an attachment is refused with a
554reply. - Email sent over SMTP counts as transactional. Add the header
X-ZosMail-Category: marketingto newsletters and promotions.
Don't use the "email all members" feature of a forum or shop over SMTP as transactional email. The same message going to many people breaks the transactional rules and suspends the account. Send it as a campaign instead.
Server replies
| Reply | Meaning |
|---|---|
250 | Accepted. The reply includes the ID of the first message. |
452 | Too many recipients. Split the message into groups of 50. |
535 | The API key is wrong or was revoked. |
550 | Refused, for example a recipient failed the address checks. The reply says why. |
554 | Refused because of your account: not enough credits, sending paused, account suspended, incomplete company details, or an attachment. |
451 | A temporary problem on our side. Try again in a few minutes. |