A high-performance email sending and monitoring server utilizing AWS SES and SNS. Built with Rust and Tokio for exceptional throughput and reliability.
- 🦀 Backend: Rust + Axum
- 📨 Email Service: AWS SES
- 🔔 Notification: AWS SNS
- 🔄 Async Runtime: Tokio
- 💾 Database: SQLite
- Receive API request (
/v1/messages
) - Store sending request in database
- Immediately forward to sender via Tokio channel
- Process sequentially according to AWS SES sending rate limits
- Asynchronously store sending results
- Receive API request (with scheduled_at)
- Store scheduling information in database
- Scheduler checks for scheduled tasks every minute
- Forward scheduled emails to sender when time comes
- Process using the same flow as immediate sending
- Utilizing Tokio-based async runtime
- Minimizing resource usage with lightweight threads
- Efficient task distribution via channels
- Automatic compliance with AWS SES sending rate limits
- 🚀 Bulk email sending and scheduling
- 📊 Real-time delivery monitoring
- 👀 Email open tracking
- ⏸ Cancel pending email sends
- 📈 Sending statistics and analysis
👉 See details: Refer to this blog
- AWS SES starts in sandbox mode by default
- Request sandbox removal through AWS Support Center for production use
- Register domain in AWS SES console
- Add DKIM and SPF records to DNS (using provided records)
- Authentication may take up to 72 hours
- Register sender email in AWS SES console
- Complete verification via confirmation email link
- Create new topic in AWS SNS console
- Set topic name for notifications
- Create new configuration in SES Configuration Sets
- Add SNS event destination
- Events: Bounce, Complaint, Delivery
- Link to created SNS topic
- Add subscription to SNS topic (HTTP/HTTPS, Email, SQS)
- Complete subscription confirmation
- HTTP/HTTPS: Handle confirmation request at endpoint
- Email: Click confirmation link
# AWS Configuration
AWS_REGION=ap-northeast-2
AWS_ACCESS_KEY_ID=your_access_key
AWS_SECRET_ACCESS_KEY=your_secret_key
AWS_SES_FROM_EMAIL=your_verified_email
# Server Configuration
SERVER_URL=http://localhost:3000
SERVER_PORT=3000
DATABASE_URL=sqlite://sqlite3.db
JWT_SECRET=your_secret_key # Optional
MAX_SEND_PER_SECOND=12
SENTRY_DSN=your_sentry_dsn # Optional
POST /v1/messages
Handle bulk email sending and scheduling.
{
"messages": [
{
"topic_id": "newsletter_2024_01", // Custom identifier
"emails": ["user@example.com"],
"subject": "January Newsletter",
"content": "Hello..." // HTML format
}
],
"scheduled_at": "2024-01-01 09:00:00" // Optional
}
POST /v1/events/results
Receive real-time delivery results from AWS SES:
- ✅ Delivery: Successfully sent
- ❌ Bounce: Delivery failed
⚠️ Complaint: Spam report
GET /v1/events/open?request_id={request_id}
Track email opens using a 1x1 transparent image.
- Automatically included at email bottom
- Records opens on server automatically
- Identify individual recipients via request_id
GET /v1/events/counts/sent
Check AWS SES daily sending quota and remaining capacity.
GET /v1/topics/{topic_id}
Get aggregated results by topic_id:
- Total sent
- Success/failure count
- Open count
DELETE /v1/topics/{topic_id}
Cancel pending email sends.
- Cancels all pending emails for topic_id
- Already sent emails cannot be cancelled