0

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)?

Thanks

(exim 4.69 on Debian Linux)

Reed Hedges
  • 105
  • 1
  • 5

2 Answers2

1

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.)

Walter Mundt
  • 354
  • 1
  • 4
  • 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
0

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)

Reed Hedges
  • 105
  • 1
  • 5