views:

23

answers:

1

This is not technically a programming question but perhaps someone can help me. Yes, it's totally off topic, but i'm desperate for help as I'm no expert at this type of thing.

We had a problem on our mail server over the weekend and upon updating postfix, i noticed that mail was no longer being delivered to the /home/$user/Maildir/ as defined by the alias map. We have now fixed that, and mail is getting delivered, but previous mail that was not being delivered to mailboxes was stacking up in the spool in /var/mail as flat files containing email data.

I would like to get postfix (or whatever other program ... from postfix i use procmail to filter) to go through those files again and deliver to the appropriate mailbox. I have tried 'postqueue -f' but that hasn't done anything. 'mailq' obviously says that the mail queue is empty.

Can anyone help?? :)

A: 

Nevermind, problem solved, I hope this helps someone else. After much searching, this is the method that works. Your paths may be different.

it is user specific, depending on how your server is set up. So if you have multiple users. So:

1) Log in as user. I called my test user 'testytest' ... don't ask

cp /var/mail/testytest ~/send-testytest
cat ~/send-testytest | formail -s procmail
rm ~/send-testytest

2) Log in as root

rm /var/mail/testytest

That should work. I hope it helps anyone struggling with this!

First we make a copy of the mail spool file in question. This is apparently to prevent an infinite processing loop. We read the whole mail file, and then with that we use formail, which comes with procmail, to re-process. It will then use procmail to distribute as it would normally. :)

David