Send with SMTP
Send through usend from any app, framework or CMS that speaks SMTP, using your API key as the password.
Anything that can send email over SMTP can send through usend: WordPress, Laravel, Django, Rails, Nodemailer, a printer, a cron job. SMTP submissions go through the same pipeline as the API, so sandbox rules, quotas, suppressions, tracking, events and webhooks behave exactly the same, and the email shows up in your dashboard logs.
You can also copy these settings from Settings → SMTP in the dashboard.
Settings
| Setting | Value |
|---|---|
| Host | smtp.usend.et |
| Port | 587 (STARTTLS) or 465 (implicit TLS) |
| Encryption | Required. Plain connections and port 25 are not offered. |
| Username | usend (any value works; it is ignored) |
| Password | Your API key, for example us_123456789 |
| Authentication | PLAIN or LOGIN |
Use a sending_access key for SMTP. Both full_access and sending_access keys are accepted, and a key limited to one domain can only send from that domain.
The server never offers authentication before the connection is encrypted. A client that tries to log in over a plain connection is disconnected before it can send the key.
Examples
// npm install nodemailer
import nodemailer from 'nodemailer';
const transport = nodemailer.createTransport({
host: 'smtp.usend.et',
port: 465,
secure: true, // use port 587 with secure: false for STARTTLS
auth: { user: 'usend', pass: process.env.USEND_API_KEY },
});
await transport.sendMail({
from: 'Acme <[email protected]>',
to: '[email protected]',
subject: 'Hello from usend',
html: '<p>It works!</p>',
});import os, smtplib, ssl
from email.message import EmailMessage
msg = EmailMessage()
msg["From"] = "Acme <[email protected]>"
msg["To"] = "[email protected]"
msg["Subject"] = "Hello from usend"
msg.set_content("It works!")
msg.add_alternative("<p>It works!</p>", subtype="html")
with smtplib.SMTP_SSL("smtp.usend.et", 465, context=ssl.create_default_context()) as s:
s.login("usend", os.environ["USEND_API_KEY"])
s.send_message(msg)MAIL_MAILER=smtp
MAIL_HOST=smtp.usend.et
MAIL_PORT=587
MAIL_USERNAME=usend
MAIL_PASSWORD=us_123456789
MAIL_ENCRYPTION=tls
[email protected]
MAIL_FROM_NAME=AcmeEMAIL_HOST = "smtp.usend.et"
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = "usend"
EMAIL_HOST_PASSWORD = os.environ["USEND_API_KEY"]
DEFAULT_FROM_EMAIL = "Acme <[email protected]>"config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: "smtp.usend.et",
port: 587,
user_name: "usend",
password: ENV.fetch("USEND_API_KEY"),
authentication: :plain,
enable_starttls_auto: true,
}swaks --server smtp.usend.et --port 587 --tls \
--auth PLAIN --auth-user usend --auth-password "$USEND_API_KEY" \
--from [email protected] --to [email protected] \
--header "Subject: Hello from usend" --body "It works!"For WordPress, use any SMTP plugin with the settings above. In tools with a "security" dropdown, choose TLS/STARTTLS for 587 and SSL for 465.
What is supported
- Content: HTML, plain text, or both, with attachments (up to 40 MB per message in total).
- Recipients: up to 50 per message across To, Cc and Bcc. Envelope recipients that are not in To or Cc are sent as Bcc.
- Headers:
Reply-To,List-UnsubscribeandList-Unsubscribe-Post, and anyX-header, are kept. Other headers are replaced by usend's own. - From address: it must be on a verified domain of your organization, as with the API.
- Rate limit: the same 10 messages per second per key as the API. Over the limit the server answers
421and a well-behaved client retries. - Scheduling, templates, tags, idempotency keys and batch sending are API features. Use the REST API for those.
The server answers 250 once usend has accepted the message for delivery, the same moment the API returns an id. Delivery results arrive later as events and webhooks. SMTP does not return the email id: find the email in the dashboard, or use the API when you need it.
Errors
| Reply | Meaning | What to do |
|---|---|---|
535 Invalid API key | The password is not a valid key. | Check the key, and that it was not deleted. |
554 with a message | usend refused the message: the domain is not verified, the organization is suspended or restricted, the key is limited to another domain, and so on. | Read the message; it is the same text the API returns. Do not retry. |
452 | A quota or a recipient limit was reached. | Wait, or raise your limits. |
421 | Rate limit exceeded. | Retry after a moment. |
451 | Temporary failure on usend's side. | Retry. |
552 | The message is larger than 40 MB. | Send smaller attachments. |
Checking the connection
openssl s_client -starttls smtp -connect smtp.usend.et:587 -crlf
openssl s_client -connect smtp.usend.et:465Both show a valid certificate for smtp.usend.et. If your network blocks outbound ports 465 and 587, use the REST API over HTTPS instead.