Mail โ Email Service Configuration (SendGrid)
Last reviewed: 2026-05-29
Transactional email is automatically triggered by user actions (sign-ups, password resets, order confirmations, notifications). SendGrid is a cloud-based email delivery platform that handles sending at scale with high deliverability.
Overview
This folder stores configuration for SendGrid API integration, used for sending transactional emails from applications. SendGrid provides: - SMTP relay service - REST API for email sending - Email templates (dynamic templates) - Delivery analytics (opens, clicks, bounces, spam reports) - Suppression management (unsubscribes, bounces) - IP reputation management
Training Content
- API key(s) for programmatic email sending
- Sender verification details (sender email, domain authentication)
- Integration instructions for various platforms
โ ๏ธ Security note: API key file โ credentials are not shown in the training listing for security reasons.
SendGrid Integration
SMTP Configuration
| Setting | Value |
|---|---|
| Server | smtp.sendgrid.net |
| Port | 587 (TLS) or 465 (SSL) |
| Username | apikey |
| Password | Your SendGrid API key |
API Usage (REST)
# Send email via SendGrid API v3
curl --request POST \
--url https://api.sendgrid.com/v3/mail/send \
--header "Authorization: Bearer YOUR_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"personalizations": [{"to": [{"email": "recipient@example.com"}]}],
"from": {"email": "sender@yourdomain.com"},
"subject": "Hello from SendGrid",
"content": [{"type": "text/plain", "value": "Email body text"}]
}'
Python with sendgrid library
from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail
message = Mail(
from_email='sender@yourdomain.com',
to_emails='recipient@example.com',
subject='Hello',
plain_text_content='Email body'
)
sg = SendGridAPIClient('YOUR_API_KEY')
response = sg.send(message)
Email Deliverability Best Practices
- Authenticate your domain:
- SPF โ Sender Policy Framework (authorized sending IPs)
- DKIM โ DomainKeys Identified Mail (cryptographic signing)
- DMARC โ Domain-based Message Authentication, Reporting & Conformance
- Warm up your sending IP โ Gradually increase volume when using a new IP
- Monitor bounces and complaints โ Remove invalid addresses, respect unsubscribe requests
- Use dedicated sending IPs โ For high-volume senders
- Avoid spam triggers โ No misleading subject lines, clean HTML, proper text/plain alternative
SendGrid Features
| Feature | Description |
|---|---|
| Dynamic Templates | Handlebars-based email templates managed in SendGrid UI |
| Substitution Tags | Personalize emails with user-specific data |
| Categories | Track email performance by category tag |
| Suppression Groups | Managed unsubscribe groups |
| Webhooks | Receive real-time event data (delivered, opened, clicked, bounced) |
| Batch sending | Send to multiple recipients with personalized content |
Resources
- SendGrid Documentation
- SendGrid API Reference
- Email Deliverability Guide
- AWS SES โ Alternative email service
- Resend โ Modern email API alternative