Mail Fail
Over the last two weeks I have been receiving a lot less junk mail, which is something I should be quite happy with. But then I was also missing my Aldi and Lidl newsletters, which I was not happy about. So first port of call was looking through the spamassassin logs to see why it decided to go very aggressive lately. But after a while of looking, it looked like spamassassin was not removing those mails. Next, sending mails to myself and although sendmail and spamassassin claim these were delivered, they were not there. All the while I am happily receiving many mails from lists I am subscribed to. So next thing to check was procmail. And there it was, a tiny typo that delivered any mail which did not get caught by one of the previous filters to a random filename.
This is what a standard procmail filter looks like. This says match mails from the mailing list and place them in an IMAP subfolder.
:0: * List-Post: <mailto:list-name@domain.tld> .Directory.Subdirectory/
Except when the star in the second line is missing. Then it says deliver all mail to a file called “List-Post:” happily hidden amongst the other files in the mail directory. And that is exactly what happened. Most mails were filtered to their correct directories until it hit this line and all remaining mail (mostly spam) was delivered to a file.
So what to do when you have done the same thing as me and you have what is essentially a “mbox” file with all the mail you wanted to be delivered properly? It couldn’t be easier, you simply split the mbox file into individual mails and feed them into procmail. To do this you run:
> cat List-Post: | formail -s procmail
You take the mbox, and pipe it into formail which then takes each mail and runs procmail on it. This delivers it to your correct mailbox. Obviously your mbox file might not be called “List-Post:”, but this way you will receive all your lovely mail that you have been missing. Now I have to catch up on the 400 mails that I have just received, on the positive side I have just won “250,000.00 euro (Two Hundred and Fifty Thousand Euros Only)”.