1.8 KiB
1.8 KiB
SMTP delivery fallback patterns
When a script or cron job needs to send an email but SMTP is unreachable, use these fallback strategies.
Current SMTP configuration
| Setting | Value |
|---|---|
| Host | mail.germainebrown.com |
| Port | 2525 (NOT 587 — netcup blocks 25, 465, 587) |
| TLS | STARTTLS |
| From (outbound) | g@germainebrown.com |
| Password file | /root/.config/himalaya/g-germainebrown.pass |
Why 2525: Netcup VPS blocks outbound ports 25, 465, and 587. The MXroute mail server (mail.germainebrown.com) accepts SMTP on port 2525. This was tested and confirmed working for both g@germainebrown.com and shonuff@germainebrown.com.
Detect SMTP reachability first
import socket
for port in [2525, 587, 465]:
s = socket.socket()
s.settimeout(5)
try:
s.connect(('mail.germainebrown.com', port))
print(f'Port {port}: available')
s.close()
except (socket.timeout, ConnectionRefusedError, OSError):
print(f'Port {port}: blocked')
Fallback: Wasabi S3 upload
If SMTP is completely unreachable:
source /opt/awscli-venv/bin/activate
aws s3 cp <path/to/file> s3://hermes-vps-backups/<filename> \
--endpoint-url https://s3.us-east-1.wasabisys.com/
Then notify the user via Telegram/DM: "File uploaded to Wasabi — grab it at s3://bucket/key"
All scripts updated to use port 2525
The following files were patched from 587 → 2525 (confirmed working):
/root/.hermes/scripts/send-recovery.py/root/.hermes/scripts/send-backup-email.py/root/.hermes/scripts/send-backup-readme.py/root/.hermes/scripts/daily-feed-summary.py/root/.config/himalaya/shonuff.toml
Future services (Mautic, etc.)
Any new service that sends email from this box must use port 2525, not 587. Netcup's outbound port blocking applies to all servers in their network.