[URGENT] Requeue (process again) all the email blocked in the last 12 hours

General eFa discussion
Post Reply
fbessone
Posts: 10
Joined: 18 Feb 2015 18:02

[URGENT] Requeue (process again) all the email blocked in the last 12 hours

Post by fbessone » 14 Sep 2018 09:23

Hello guys,

tonight my EFA blocked all emails with this error:
MailScanner: Message attempted to kill MailScanner

I solved the error, clamAV related: but now i want to process again all the blocked emails to deliver the legimit ones.
How can i do it? There are thousands of email, cant do it manually via web interface ..

Thank you in advance

User avatar
shawniverson
Posts: 2766
Joined: 13 Jan 2014 23:30
Location: Rushville, Indiana, USA
Contact:

Re: [URGENT] Requeue (process again) all the email blocked in the last 12 hours

Post by shawniverson » 14 Sep 2018 10:39

Hi,

You will need to use a script to accomplish this. The process..

1) Gather all messages and place in a directory
2) Use a script to iterate through the files, extract the original recipient address, and call /usr/sbin/sendmail to requeue the message.

Code: Select all

#!/bin/bash
pathname='/path/to/files/'
for filename in $pathname; do
   if [[ -f "$filename" ]]; then
       # extract orig recip
       recip=$(grep "^[[:space:]]*for" $pathname$filename | head -n1 | awk '{print $2}' | sed 's/^<//' | sed 's/>$//' | sed 's/>;$//')
       if [[ -n "$recip" ]]; then
         sendmail -G -i $recip < $pathname$filename
       fi
   fi
done
Version eFa 4.0.0 RC3 now available in testing repo. Come join us in advancing eFa!

p88
Posts: 4
Joined: 12 Feb 2018 08:41

Re: [URGENT] Requeue (process again) all the email blocked in the last 12 hours

Post by p88 » 17 Dec 2018 09:58

Hi,

i got the same situation, needed to resend incoming mails ( which where at the quarantine folders) to the local mail server.

The script was above was'nt working, i used this script:

pathname='/var/spool/MailScanner/quarantine/20181103/nonspam'

for filename in "$pathname"/*
do
/usr/sbin/sendmail.postfix -t < "$filename"
done

it should be adopted ( sendmail.postfix is different to sendmail) and it would be great to have a menu point somewhere to just select the date to resend emails from the nonspam folders to the internal users.

Post Reply