Email Integration
Configure email notifications for ban alerts and daily summaries.
Setup
1. Configure SMTP
- Go to Settings → Email / SMTP
- Enter your SMTP settings:
- Host
- Port
- Username
- Password
- From Address
- TLS settings
- Click Test Connection
- Click Save
Or via environment variables:
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_USER=notifications@example.com
SMTP_PASS=your_password
SMTP_FROM=Bloqd <notifications@example.com>
SMTP_TLS=true
SMTP Configuration
Common Providers
| Provider | Host | Port | TLS |
|---|---|---|---|
| Gmail | smtp.gmail.com | 587 | Yes |
| Office 365 | smtp.office365.com | 587 | Yes |
| Mailgun | smtp.mailgun.org | 587 | Yes |
| SendGrid | smtp.sendgrid.net | 587 | Yes |
| Amazon SES | email-smtp.region.amazonaws.com | 587 | Yes |
Gmail Setup
For Gmail, you need an App Password:
- Enable 2-Step Verification on Google Account
- Go to Security → App passwords
- Generate password for "Mail"
- Use this password in Bloqd SMTP settings
Self-Hosted Mail
host: localhost
port: 25
username: ""
password: ""
tls: false
Notification Types
Daily Summary
Sent once per day with aggregated statistics.
Contents:
- Total bans (24h)
- Unique IPs banned
- Top attacking countries
- Top targeted jails
- Server health status
- Notable events
Alert Emails
Sent for specific events:
- Server goes offline
- Critical health issues
- License expiration warnings
- Security events
Configuration Options
| Setting | Description | Default |
|---|---|---|
| Daily Summary | Enable daily report | On |
| Summary Time | When to send (UTC) | 08:00 |
| Recipients | Email addresses | Admin email |
| Alert Emails | Send critical alerts | On |
Recipients
Single Recipient
recipients: admin@example.com
Multiple Recipients
recipients: admin@example.com,security@example.com
Email Format
Daily Summary
Subject: Bloqd Daily Summary - 2024-01-15
=============================================
BLOQD SECURITY SUMMARY
2024-01-15
=============================================
OVERVIEW
--------
• Total Bans: 247
• Unique IPs: 89
• Servers Monitored: 5
TOP ATTACKING COUNTRIES
-----------------------
1. China (45%) - 112 bans
2. Russia (23%) - 57 bans
3. United States (12%) - 30 bans
TOP JAILS
---------
1. sshd - 156 bans
2. nginx-botsearch - 52 bans
3. postfix-sasl - 39 bans
SERVER STATUS
-------------
✓ web-server-01 - Healthy
✓ mail-server-01 - Healthy
✓ db-server-01 - Healthy
Alert Email
Subject: [ALERT] Server Offline - web-server-01
=============================================
BLOQD ALERT
=============================================
Server: web-server-01
Status: OFFLINE
Last Seen: 2024-01-15 10:25:00 UTC
Duration: 5 minutes
The server has not sent a heartbeat for 5 minutes.
Please investigate immediately.
Testing
Test SMTP Connection
- Go to Settings → Email / SMTP
- Click Test Connection
- Enter test recipient
- Check inbox for test email
Manual Test
curl -X POST "https://bloqd.example.com/api/v1/settings/smtp/test" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"recipient": "test@example.com"}'
Troubleshooting
Connection Failed
SMTP Error: Connection refused
- Verify host and port
- Check firewall allows outbound SMTP
- Verify TLS settings match server
Authentication Failed
SMTP Error: Authentication failed
- Verify username/password
- For Gmail, use App Password
- Check account isn't locked
TLS Error
SMTP Error: SSL/TLS handshake failed
- Try different port (465 vs 587)
- Enable/disable STARTTLS
- Verify certificate is valid
Email in Spam
- Set up SPF record for sending domain
- Configure DKIM if available
- Use reputable SMTP provider
- Ensure FROM address is valid
Security
- Store SMTP credentials securely
- Use TLS for all connections
- Consider dedicated email for notifications
- Don't expose SMTP credentials in logs