Delete old( 1hour)mailer daemon emails

Discussion in 'ISPConfig 3 Priority Support' started by rob_morin, Nov 23, 2016.

  1. rob_morin

    rob_morin Member HowtoForge Supporter

    Hello, we get a lot of mailer daemons due to an email coming in to a non existent user, so then an email is returned to sender to say the user does not exist, but if that reply to email is bogus, the email gets stuck in the queue. So i figure any emails that are stuck in the queue for over and hour for sure are probably no legit. I want to delete these emails automatically.

    Any ideas? like run a script every hour to delete old emails in the queue?

    Thanks
     
  2. florian030

    florian030 ISPConfig Developer ISPConfig Developer

    postqueue -p | tail -n +2 | awk 'BEGIN { RS = "" } /MAILER-DAEMON/ { print $1 }' | tr -d '*!' | postsuper -d -

    removes all mails for MAILER-DAEMON from the queue
     

Share This Page