SparkPost SMTP Settings
Complete guide to configure SparkPost SMTP for high-speed email delivery from your application.
Note: SparkPost is now part of Bird
SparkPost was acquired by MessageBird (now Bird). Existing accounts continue to work normally with the same SMTP settings.
table_chart Quick Reference
| Setting | Value |
|---|---|
| SMTP Server (US) | smtp.sparkpostmail.com |
| SMTP Server (EU) | smtp.eu.sparkpostmail.com |
| Port (TLS) | 587 Recommended |
| Alternative Port | 2525 |
| Username | SMTP_Injection (literal value) |
| Password | Your API Key |
| Encryption | STARTTLS |
| Free Tier | 500 emails/month |
Step-by-Step Setup Guide
Create SparkPost Account
Sign up at app.sparkpost.com (US) or app.eu.sparkpost.com (EU for GDPR compliance).
Verify Your Sending Domain
Navigate to Configuration > Sending Domains. Add your domain and configure DKIM by adding the TXT record to your DNS.
Create API Key
Go to Configuration > API Keys. Create a key with 'Send via SMTP' permission.
The API key is shown only once! Copy and store it securely.
Configure SMTP Settings
Use smtp.sparkpostmail.com:587 with username 'SMTP_Injection' (literal value) and your API key as password.
Code Examples
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
# SparkPost SMTP settings
SMTP_HOST = "smtp.sparkpostmail.com"
SMTP_PORT = 587
SMTP_USER = "SMTP_Injection" # Always use this value
SMTP_PASS = "your-api-key-here"
# Create message
msg = MIMEMultipart()
msg['From'] = "sender@yourdomain.com"
msg['To'] = "recipient@example.com"
msg['Subject'] = "Test Email via SparkPost"
body = "This is a test email sent via SparkPost SMTP."
msg.attach(MIMEText(body, 'plain'))
# Send email
with smtplib.SMTP(SMTP_HOST, SMTP_PORT) as server:
server.starttls()
server.login(SMTP_USER, SMTP_PASS)
server.send_message(msg)
print("Email sent successfully!")
SparkPost Custom Headers
SparkPost supports the X-MSYS-API header for advanced features:
X-MSYS-API: {
"options": {
"open_tracking": true,
"click_tracking": true,
"transactional": true
},
"metadata": {
"campaign_id": "my-campaign"
}
}
open_tracking- Track email opensclick_tracking- Track link clickstransactional- Mark as transactional email
Pricing
500 emails/month
- check SMTP & API
- check Analytics
- check Webhooks
/month
- check 50,000+ emails
- check Advanced analytics
- check Dedicated IPs
- check Priority support
Troubleshooting
550 5.7.1 Unconfigured Sending Domain
Your sending domain is not verified. Go to Configuration > Sending Domains and verify your domain with DKIM.
535 5.7.8 Authentication failed
Ensure username is exactly 'SMTP_Injection' and your API key is correct. Generate a new API key if needed.
Connection timeout
Try port 2525 instead of 587. Also verify you're using the correct regional server (US vs EU).
Frequently Asked Questions
Why is the username 'SMTP_Injection'?
SparkPost uses a fixed username for all accounts. Authentication is handled entirely through the API key.
Should I use US or EU server?
Use EU server (smtp.eu.sparkpostmail.com) for GDPR compliance. Otherwise, US server works well worldwide.