Guides / Sending email
Send email from your server
Outgoing connections to ports 25, 465 and 587 are blocked on every plan, over IPv4 and IPv6. One spammer would get our shared IPv4 address blocklisted for everyone, and mail from a shared address lands in spam anyway. Sending through an email service works better.
Option A: an email API (recommended)
Services such as Resend, Postmark, Mailgun or Amazon SES give you an HTTPS API. Your app sends a request on port 443, which is not blocked, and the service delivers the mail with proper SPF and DKIM for your domain. Most have a free tier for small volumes.
curl -X POST https://api.resend.com/emails \
-H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" \
-d '{"from":"you@example.com","to":["friend@example.org"],"subject":"Hello","text":"Sent from my natbox server"}'
Option B: an SMTP relay on port 2525
For software that only speaks SMTP, many providers also accept SMTP on port 2525, which is open. Check your provider's documentation for its 2525 host. With Postfix:
apt install -y postfix libsasl2-modules # choose "Satellite system"
postconf -e "relayhost = [smtp.your-provider.com]:2525" \
"smtp_sasl_auth_enable = yes" "smtp_sasl_password_maps = static:USERNAME:PASSWORD" \
"smtp_sasl_security_options = noanonymous" "smtp_tls_security_level = encrypt"
systemctl restart postfix
echo "test" | mail -s "relay test" you@example.org
Receiving email
Receiving needs port 25 inbound on your own IPv4 address, which a shared address cannot give you. Use a forwarding service (such as ImprovMX) or a hosted mailbox for your domain's MX records.