Universal scripts for solving email delivery issues with Postfix when certain domains block direct SMTP connections.
- Blocked port 25 - ISP blocks outgoing SMTP traffic
- Gmail restrictions - IP address not authorized for direct sending
- Configuration errors - Duplicate SSL certificates in Postfix
fix_postfix.sh- Fix Postfix configuration (certificates)clean_queue.sh- Clean mail queueforce_clean.sh- Force clean all messages
setup_smtp_tunnel.sh- Create SSH tunnel for SMTPconfigure_postfix_tunnel.sh- Configure Postfix for tunnelpermanent_tunnel_setup.sh- Systemd service for permanent tunnel
gmail_solutions.sh- Overview of Gmail solutionssetup_gmail_relay.sh- Setup relay through SSH tunnel
-
Replace placeholders in scripts:
remote-server→ your relay server hostnameyour-domain.example.com→ your domainuser@→ your email addresses
-
Diagnose the problem
tail -f /var/log/mail.log mailq
-
Create SSH tunnel
./setup_smtp_tunnel.sh ./configure_postfix_tunnel.sh
-
Gmail solution
./setup_gmail_relay.sh
- Linux server with Postfix
- SSH access to relay server
- sudo permissions for configuration
- Ubuntu 24.04 LTS
- Postfix 3.8
- ISP blocking port 25
These scripts are freely available for solving similar problems.