45 lines
2.1 KiB
Markdown
45 lines
2.1 KiB
Markdown
# Postfix SMTP Relay for RunCloud-Managed Servers
|
|
|
|
When a RunCloud-managed server (like wphost02) has stuck email in Postfix queue because port 25 is blocked, relay through `mail.germainebrown.com:2525` with SASL auth and sender-domain rewriting.
|
|
|
|
## Symptom
|
|
`mailq` shows 60+ messages deferred with `(connect to ...:25: Connection timed out)`. The server tries to send directly to destination MX servers but port 25 is blocked.
|
|
|
|
## Fix
|
|
```bash
|
|
# Configure relay
|
|
postconf -e "relayhost = mail.germainebrown.com:2525"
|
|
postconf -e "smtp_sasl_auth_enable = yes"
|
|
postconf -e "smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd"
|
|
postconf -e "smtp_sasl_security_options = noanonymous"
|
|
postconf -e "smtp_tls_security_level = encrypt"
|
|
postconf -e "myorigin = /etc/mailname"
|
|
|
|
# Auth credentials (use shonuff's SMTP account)
|
|
echo "mail.germainebrown.com:2525 shonuff@germainebrown.com:Catches.bullets1985" > /etc/postfix/sasl_passwd
|
|
chmod 600 /etc/postfix/sasl_passwd
|
|
postmap /etc/postfix/sasl_passwd
|
|
|
|
# Sender rewriting — MXroute requires real sender domain, not wphost02.local
|
|
echo "apextrackexperience.com" > /etc/mailname
|
|
echo "@wphost02 contact@apextrackexperience.com" > /etc/postfix/generic
|
|
echo "root@wphost02 contact@apextrackexperience.com" >> /etc/postfix/generic
|
|
postmap /etc/postfix/generic
|
|
postconf -e "smtp_generic_maps = hash:/etc/postfix/generic"
|
|
|
|
systemctl restart postfix
|
|
postqueue -f # flush the stuck queue
|
|
```
|
|
|
|
## Verification
|
|
`mailq` says "Mail queue is empty". Logs show `relay=mail.germainebrown.com[65.109.144.50]:2525` with `status=sent`.
|
|
|
|
## Note
|
|
Old queued messages will get bounce notices (they were deferred too long). New emails flow through the relay cleanly. MXroute rejects `550 Envelope sender domain must be a fully qualified name` if the sender is `runcloud@wphost02` — the `smtp_generic_maps` rewrite fixes this.
|
|
|
|
## Trigger Symptom Chain
|
|
1. WP Mail SMTP on wphost02 configured for c1113726.sgvps.net:2525 (works for WP)
|
|
2. PHP mail() falls back to Postfix, which does direct MX delivery on port 25
|
|
3. Port 25 blocked → emails in deferred queue forever
|
|
4. WPForms notifications and system emails pile up
|