Quickstart
Send your first email over SMTP
Get your SMTP credentials, pick a port and send a test email through smtp.emailit.com with swaks, OpenSSL or Python, then connect your app or framework.
This quickstart shows you how to send a test email through the Emailit SMTP relay from your terminal, then connect your own app. Use SMTP when your software already has SMTP settings. For new code, the API does more.
Before you begin
- A verified sending domain. If you don’t have one yet, follow the first section of the API quickstart or Add a domain.
- An API key. Create one in Email APIAPI Keys with Add API key. Your API key is your SMTP password.
Your SMTP credentials
| Setting | Value |
|---|---|
| Host | smtp.emailit.com |
| Port | 587 with STARTTLS (recommended). See the table below for alternatives. |
| Username | emailit |
| Password | Your API key, starting with secret_ |
| Authentication | PLAIN or LOGIN |
| From address | Any address on a verified sending domain, for example Acme <hello@acme.com> |
You can also see these settings on the SMTP Info card when you open a key in Email APIAPI Keys.
| Port | Encryption | When to use it |
|---|---|---|
587 |
STARTTLS | The default for most apps and libraries |
465 |
TLS from the first byte (implicit TLS) | When your client calls it “SSL” or “SMTPS” |
2525 |
STARTTLS | When your network or hosting provider blocks 587 |
2587 |
STARTTLS | Another alternative when 587 and 2525 are blocked |
25 |
STARTTLS | Server-to-server relaying. Many cloud providers block outbound port 25. |
The relay offers TLS on every port but doesn’t force it. Always turn TLS on in your client so your API key isn’t sent in plain text.
Send a test email
Pick one of these tools. Replace hello@acme.com with an address on your verified domain, and ada@example.com with the email address you signed up with.
swaks
swaks is a command-line SMTP test tool. Install it with brew install swaks or apt install swaks, then run:
swaks --server smtp.emailit.com:587 --tls \
--auth-user emailit --auth-password "$EMAILIT_API_KEY" \
--from hello@acme.com --to ada@example.com \
--header "Subject: Hello from Emailit SMTP" \
--body "This is my first email sent through the Emailit SMTP relay."swaks prints the whole SMTP conversation. The last reply from the server contains the email ID:
<~ 250 2.0.0 OK: queued as em_2pX7cN4kQ9vLm3RtB8yWd1ZsOpenSSL
OpenSSL is preinstalled on most systems and lets you type the SMTP commands yourself. First, encode your credentials for AUTH PLAIN:
printf '\0emailit\0%s' "$EMAILIT_API_KEY" | base64Then open a connection and type the commands below, pasting the encoded string after AUTH PLAIN:
openssl s_client -connect smtp.emailit.com:587 -starttls smtp -crlf -quietEHLO localhost
AUTH PLAIN AGVtYWlsaXQAc2VjcmV0X...
MAIL FROM:<hello@acme.com>
RCPT TO:<ada@example.com>
DATA
From: Acme <hello@acme.com>
To: ada@example.com
Subject: Hello from Emailit SMTP
This is my first email sent through the Emailit SMTP relay.
.
QUITAfter AUTH PLAIN the server answers 235. After the line with a single ., it answers 250 2.0.0 OK: queued as em_….
Python
Python’s built-in smtplib needs no extra packages:
import os
import smtplib
from email.message import EmailMessage
msg = EmailMessage()
msg["From"] = "Acme <hello@acme.com>"
msg["To"] = "ada@example.com"
msg["Subject"] = "Hello from Emailit SMTP"
msg.set_content("This is my first email sent through the Emailit SMTP relay.")
msg.add_alternative("<p>This is my first email sent through the Emailit SMTP relay.</p>", subtype="html")
with smtplib.SMTP("smtp.emailit.com", 587) as smtp:
smtp.starttls()
smtp.login("emailit", os.environ["EMAILIT_API_KEY"])
smtp.send_message(msg)
print("Accepted by Emailit")If the script finishes without an exception, Emailit has accepted the email.
Check it in the dashboard
Go to Email APIEmails. Your email is at the top of the Outgoing tab, and its status changes from accepted to delivered once the recipient’s server accepts it. Each SMTP session also appears in Email APILogs with the source SMTP, so you can see failed logins and rejected messages too.
Common replies
| Reply | Cause | Fix |
|---|---|---|
535 Authentication failed |
Wrong or deleted API key | Use a current API key as the password. See 535 errors. |
530 From/Sender domain is not verified for this workspace |
The From address isn’t on a verified domain | Verify the domain, or change the From address. See 530 errors. |
550 Unverified workspaces can only send to workspace members' account emails |
Sandbox mode | Send to a member’s account email, or request production access |
452 4.4.5 Messages per second limit exceeded |
More than your per-second limit | Slow down and retry. Limits are shared with the API. |
452 4.5.3 Daily message limit exceeded |
You reached today’s limit | Wait until midnight UTC, or request an increase |
| Connection timeout | Your network blocks the port | Try 2525 or 2587. See Connection timeouts. |
For every reply code, see SMTP troubleshooting.
Connect your app
Put the same settings into your app or framework. These guides show the exact configuration: