• Home
  • Cisco
  • Exchange
  • Linux
  • Navision
  • Network
  • Virtualization
  • Windows
  • About
  •  

    Remove specific recipient email from postfix queue


    postqueue -p | tail -n +2 | awk ‘BEGIN { RS = “” } / refund_of_tax@mycomp\.com/ { print $1 }’ | tr -d ‘*!’ | postsuper -d –

    Script:

    #Bash
    while true; do
    sleep 5
    postqueue -p | tail -n +2 | awk ‘BEGIN { RS = “” } / refund_of_tax@mycomp\.com/ { print $1 }’ | tr -d ‘*!’ | postsuper -d –
    done

    Block the email:

    nano /etc/postfix/recipient_access
    [email protected] REJECT

    postmap /etc/postfix/recipient_access
    /etc/init.d/MailScanner restart