Prompt
How do I send alert emails from my backend without using SMTP?
Latest observation
Oct 5, 2026
OpenAI APIWeb search: off
If you want to send alert emails from a backend without running your own SMTP server, the usual approach is to use an email delivery API from a provider.
Common options
Providers expose HTTPS APIs so your backend can send mail directly:
- SendGrid
- Mailgun
- Amazon SES
- Postmark
- Resend
- SparkPost
How it works
- Create an account with an email provider.
- Verify your domain or sender address.
- Get an API key.
- From your backend, make an HTTPS request to the provider’s email-sending endpoint.
- The provider handles delivery, retries, bounces, etc.
Basic flow in your backend
When an alert event happens:
- detect the event
- build the email subject/body
- call the provider API
- log success/failure
Example: sending via an HTTP API
Here’s a generic example in Node.js using fetch:
await fetch("https://api.example-email.com/send", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.EMAIL_API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
from: "alerts@yourdomain.com",
to: "admin@yourdomain.com",
subject: "Alert: Service down",
text: "Your service is unreachable."
})
});
Best practices for alert emails
- Use a reliable provider with good deliverability
- Send from a verified domain
- Keep alerts short and actionable
- Add rate limiting/deduplication so you don’t spam yourself
- Use async/background jobs so email sending doesn’t block requests
- Log failures and retry if needed
If you don’t want email at all
For urgent alerts, consider combining email with:
- Slack/Teams notifications
- SMS
- PagerDuty/Opsgenie
- Push notifications
If you want, I can show you:
- a Node.js example using a specific provider
- a Python example
- how to set up domain verification and DNS records