Postfix Configure postfix to use Sendgrid as default Relay If you would like to configure postfix to use Sendgrid as the mail relay, you can do so by editing the postfix main configuration file. vi /etc/postfix/main.cf And then paste the content below at the end of the file : smtp_sasl_auth_enable = yes smtp_sasl_password_
manage postfix queue Postfix Queue Management Retry delivery of mail in queue : postqueue -f Flush mail for a domain to primary mail server from Relay server: postqueue -s domain.com Delete all email in queue for a domain: postqueue -p | tail -n +2 | awk 'BEGIN { RS = "" } /@example.com/ { print $1 }' | tr -d
Postfix Postfix - Sender address rejected: User unknown in virtual mailbox table Sometimes you may want to be able to send email from non existent email addresses on your own networks for notification purposes, you may get error “Sender address rejected: User unknown in virtual mailbox table”. In order to over come this issue, you have to disable this option : “smtpd_reject_
Postfix Postfix Spam Control Reject / Discard / Redirect emails based on header checks : vi /etc/postfix/main.cf header_checks = regexp:/etc/postfix/header_checks vi /etc/postfix/header_checks /^From: "Mechanic/ REJECT /^To: someone@example.com/ REDIRECT someone@example2.com /^To [someone@example2.com/%5ETo]: [bademail@example.com/ REJECT /^Subject](mailto:bademail@example.
Postfix Postfix Commands View Postfix Version : postconf -d | grep mail_version postconf -d mail_version
pcre Spam Filtering with postifx and pcre 1. Check if postfix has pcre support : postconf -m 2. Add the below lines to main.cf vi /etc/postfix/main.cf body_checks = pcre:/etc/postfix/body_checks.pcre<br></br> header_checks = pcre:/etc/postfix/header_checks.pcre``` 3. Put the keywords and details
Postfix 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.
flush mail queue Flush mail queue with various mail servers Sendmail Flush mail queue : sendmail -q Postfix Flush mail queue : postfix flush or postfix -f To view mail queue : mailq To remove all mail from the queue : postsuper -d ALL To remove all mails in the deferred queue : postsuper -d ALL deferred To remove Emails in mail queue for specific