Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a bunch of messages that were dumped by spamassasin due to errors. (mbox format, i.e. all envelope headers are present starting with "From xxx...")

How can I get exim to deliver them (to local spool files)?


(exim 4.69 on Debian Linux)

share|improve this question
up vote 1 down vote accepted

Was the error with SpamAssassin's config, or are the messages flawed somehow?

You can just split the file out into individual messages and resubmit them for normal delivery by piping them to sendmail -t (an alias to Exim on a system with Exim set up as the primary MTA). However, if the messages are problematic somehow, that won't necessarily get you anywhere. Also, if messages were originally sent to a mailing list or the like, this will resend them out to the 'net, which is undesirable.

Another option is to use Python's mailbox module to read in the mbox file and then manually drop the messages into the appropriate spools yourself; it supports most common formats. Given sufficient details, I could edit in some decent example code here.

(Python would work to split the messages out for submission too, though I'm sure a search will turn up a few dozen reasonably robust scripts for that kind of task.)

share|improve this answer
Thanks Walter. Something was screwed up with SA and spamc was not runnable. Maybe I want -ti instead of just -t though? Then if a message has a "." in it it won't stop processing there. Are there any other options that I should look for? I tried exim4 -ti on a test message and it seemed to do the right thing. – Reed Hedges Oct 27 '09 at 19:57
(Also, the messages are already split into multiple files, so that's not a problem.) – Reed Hedges Oct 27 '09 at 20:03
Yeah, -ti is probably better. Again though, be careful about not rebroadcasting messages e.g. from mailing lists or CC'd to some local user plus three dozen other people. – Walter Mundt Oct 27 '09 at 23:23

I ended up doing this:

for f in *; do if exim4 -bm -t -i -oep <$f; then mv $f ../sent/; else mv $f ../errors/; fi; sleep 2; done

and it seems to be working so far... there are about a month's worth of messages or more to get through :). (-bm means local delivery, -t means get the recipient from the message headers, -i means don't stop at ".", and -oep means print errors to stderr and exit with error code)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.