Email Providers
Configure email providers to enable email sending through MessagePipe with automatic failover support.
Supported Email Providers
SendGrid
Configuration:
{
"apiKey": "your-sendgrid-api-key"
}
Mailgun
Configuration:
{
"apiKey": "your-mailgun-api-key",
"domain": "your-domain.com"
}
Amazon SES
Configuration:
{
"accessKeyId": "your-aws-access-key",
"secretAccessKey": "your-aws-secret-key",
"region": "us-east-1"
}
SMTP
Connect any SMTP server (Gmail, Outlook, custom servers).
Configuration:
{
"host": "smtp.gmail.com",
"port": 587,
"secure": false,
"auth": {
"user": "your-email@gmail.com",
"pass": "your-app-password"
},
"tls": {
"rejectUnauthorized": false
}
}
Adding Email Providers
Add a new email provider to your project:
POST /email-config/providers?projectId={projectId}
Content-Type: application/json
Authorization: Bearer {your-jwt-token}
{
"provider": "sendgrid",
"name": "Primary SendGrid",
"enabled": true,
"priority": 1,
"config": {
"apiKey": "your-sendgrid-api-key"
}
}
Response:
{
"id": "provider-config-uuid",
"provider": "sendgrid",
"name": "Primary SendGrid",
"enabled": true,
"priority": 1,
"createdAt": "2024-01-01T10:00:00Z"
}
Managing Email Providers
Get All Email Providers
GET /email-config/providers?projectId={projectId}
Authorization: Bearer {your-jwt-token}
Update Email Provider
PUT /email-config/providers/{providerConfigId}
Content-Type: application/json
Authorization: Bearer {your-jwt-token}
{
"name": "Updated SendGrid Config",
"enabled": true,
"priority": 2,
"config": {
"apiKey": "updated-api-key"
}
}
Delete Email Provider
DELETE /email-config/providers/{providerConfigId}
Authorization: Bearer {your-jwt-token}
Email Configuration
Before adding providers, create an email configuration for your project:
POST /email-config?projectId={projectId}
Content-Type: application/json
Authorization: Bearer {your-jwt-token}
{
"senderEmail": "noreply@yourcompany.com",
"senderName": "Your Company Name",
"enabled": true
}
Get Email Configuration
GET /email-config?projectId={projectId}
Authorization: Bearer {your-jwt-token}
Update Email Configuration
PUT /email-config?projectId={projectId}
Content-Type: application/json
Authorization: Bearer {your-jwt-token}
{
"senderEmail": "hello@yourcompany.com",
"senderName": "Updated Company Name",
"enabled": true
}
Provider Priority Best Practices
- Primary Provider (Priority 1): Most reliable, fastest provider
- Secondary Provider (Priority 2): Backup with good reliability
- Tertiary Provider (Priority 3+): Additional backups or cost-effective options
Example priority setup:
- SendGrid (Priority 1) - Primary for speed and reliability
- Mailgun (Priority 2) - Secondary for backup
- SMTP (Priority 3) - Fallback option