Skip to main content

Email Integration

Configure email notifications for ban alerts and daily summaries.

Setup​

1. Configure SMTP​

  1. Go to Settings → Email / SMTP
  2. Enter your SMTP settings:
    • Host
    • Port
    • Username
    • Password
    • From Address
    • TLS settings
  3. Click Test Connection
  4. 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​

ProviderHostPortTLS
Gmailsmtp.gmail.com587Yes
Office 365smtp.office365.com587Yes
Mailgunsmtp.mailgun.org587Yes
SendGridsmtp.sendgrid.net587Yes
Amazon SESemail-smtp.region.amazonaws.com587Yes

Gmail Setup​

For Gmail, you need an App Password:

  1. Enable 2-Step Verification on Google Account
  2. Go to Security → App passwords
  3. Generate password for "Mail"
  4. 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​

SettingDescriptionDefault
Daily SummaryEnable daily reportOn
Summary TimeWhen to send (UTC)08:00
RecipientsEmail addressesAdmin email
Alert EmailsSend critical alertsOn

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​

  1. Go to Settings → Email / SMTP
  2. Click Test Connection
  3. Enter test recipient
  4. 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
  1. Verify host and port
  2. Check firewall allows outbound SMTP
  3. Verify TLS settings match server

Authentication Failed​

SMTP Error: Authentication failed
  1. Verify username/password
  2. For Gmail, use App Password
  3. Check account isn't locked

TLS Error​

SMTP Error: SSL/TLS handshake failed
  1. Try different port (465 vs 587)
  2. Enable/disable STARTTLS
  3. Verify certificate is valid

Email in Spam​

  1. Set up SPF record for sending domain
  2. Configure DKIM if available
  3. Use reputable SMTP provider
  4. 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