in reply to simple mail filter
Unfortunately, writing a Perl script to parse a Unix mailbox file to fix a problem like this is non-trivial. I mean you can probably get a regexp that'll match 98% of the messages, but generally parsing a Unix mailbox file relies on the fact that a bare 'From ' at the beginning of a line separates one message from the next.
If you can't identify/fix whatever software is causing this problem and still want to proceed along this line, something like this might work:
This changes leading 'From's that do not have an @ anywhere on the line to >From, which is usually how this is handled by mail delivery agents.perl -pi.bak -e 's/^(?=From )(?![^\@]+\@)/>/' mailbox.file
|
|---|