Postfix Tips and Tricks

Postfix mail for domain.com loops back to myself

Update mydestination using postconf or by editing main.cf file:

mydestination = localhost.$mydomain, localhost, mail.example.com

Once done reload postfix:

service postfix reload

Sender address rejected not owned by user

Remove ‘reject_sender_login_mismatch’ in postfix /etc/postfix/main.cf

Allow an IP without Auth

Discconect from unknown after auth

vi /etc/postfix/main.cf smtpd_sasl_exceptions_networks = ip/32

Postfix view Email in Queue

First find the mail ID by issuing the following command

postqueue -p

Or , for a specific email address

postqueue -p | grep –A 2 –B 2 ‘email@domain.com’

Now that you have the mail ID you can view the message by issuing the following command :

postcat –q 

Remove All Mailer Daemon Emails From Mail Queue

for emailID in mailq | grep '^[A-Z0-9]' | grep 'MAILER-DAEMON' | awk '{print$1}'| tr -d '*!'; do postsuper -d $emailID; done

Remove Email From / To an Specific Email Address from Queue :

postqueue -p | tail -n +2 | awk 'BEGIN { RS = "" } / mailer-daemon@some.server.com.domain/ { print $1 }' | tr -d '*!' | postsuper -d -