Page 1 of 1

Re-send emails in quarantine

Posted: 14 Sep 2015 14:36
by kingramon0
I might be facing the need to restore our Exchange database from a backup. If that becomes necessary, is it possible to have all the stored messages in EFA after a certain date be redelivered so we don't lose a days worth of emails?

Re: Re-send emails in quarantine

Posted: 14 Sep 2015 15:59
by shawniverson
Yes, with a little effort.

Re: Re-send emails in quarantine

Posted: 14 Sep 2015 16:02
by kingramon0
So, how would I do it?

Re: Re-send emails in quarantine

Posted: 14 Sep 2015 23:24
by shawniverson
Glad you asked ;)

1) Head over to /var/spool/MailScanner/quarantine

2) Look for the dir(s) you want, labeled by date

3) Find the nonspam dir

4) Copy the emails from the nonspam dir to /var/spool/postfix/incoming

5) Go grab a beer for a job well done.

Re: Re-send emails in quarantine

Posted: 15 Sep 2015 06:59
by kingramon0
Wow, thanks!

I'm definitely going to need a lot of step 5's, but this will make it so much easier!

Thanks again!

Re: Re-send emails in quarantine

Posted: 15 Sep 2015 07:35
by kingramon0
The files are just sitting there. Other mail is coming in but it doesn't grab the files I copied. I tried postqueue -f, but nothing. Any ideas?

Re: Re-send emails in quarantine

Posted: 15 Sep 2015 08:56
by kingramon0
I figured out that I need to chmod u+x and remove everything trailling the period in the file name. However, the messages get put in the corrupted queue.

My Mailscanner.conf has:
# Do you want to quarantine the original *entire* message as well as
# just the infected attachments?
# This can also be the filename of a ruleset.
Quarantine Whole Message = yes

# When you quarantine an entire message, do you want to store it as
# raw mail queue files (so you can easily send them onto users) or
# as human-readable files (header then body in 1 file)?
Quarantine Whole Messages As Queue Files = no

I'm guessing that is why. Changing it now won't help me. Is there something else I can do to the files to make it accept them?

Re: Re-send emails in quarantine

Posted: 15 Sep 2015 10:09
by shawniverson
Well, crud, they aren't queue files. Let me do a little tinkering.

I think we can still do this, but it may require passing the emails through a little script.

Re: Re-send emails in quarantine

Posted: 16 Sep 2015 19:32
by kingramon0
I found some ways around this that should be good enough, so don't worry about it. Fortunately, it's only a dozen or so users that I need to retrieve stuff for, and I only have two left.

Your SummitStor project is intriguing though. I might need to stalk you on that.