sendgrid
**SendGrid (Twilio): Transactional Email API**
**Overview**
SendGrid is a cloud-based SMTP provider that allows applications to send emails (password resets, invoices, notifications) without maintaining their own mail servers.
**Key Features**
**1. Deliverability**
Sending email is hard. Spam filters block unknown IPs. SendGrid manages IP reputation, DKIM, SPF, and DMARC records to ensure emails land in the Inbox, not Spam.
**2. Web API vs SMTP Relay**
- **Web API (REST)**: Faster, more secure, includes metadata.
```python
message = Mail(
from_email='[email protected]',
to_emails='[email protected]',
subject='Hello',
html_content='World')
sg = SendGridAPIClient(os.environ.get('SENDGRID_API_KEY'))
response = sg.send(message)
```
- **SMTP Relay**: Drop-in replacement for legacy apps using standard SMTP ports (587).
**3. Dynamic Templates**
Design emails in a drag-and-drop UI. Use handlebars syntax (`{{first_name}}`) in the template. The API just sends the data, not the HTML.
**4. Analytics**
Track Opens, Clicks, Bounces, and Spam Reports via Webhooks.
**Use Cases**
- **Transactional**: "Confirm your account."
- **Marketing**: Newsletters (Marketing Campaigns feature).
**Pricing**
- **Free**: 100 emails/day.
- **Essentials**: Starts at ~$20/mo for 50k emails.
SendGrid is the utility player of the internet's email infrastructure.