[ale] Parsing attachments out of email

Jay Loden jloden at toughguy.net
Fri Dec 8 16:38:55 EST 2006


Hi all :)

I currently have a need to parse incoming email on a particular mailbox. It's a long 
story, but basically, I have one of my email accounts on another server forwarding all of 
my mail to my Linux server. The catch is, Exchange rules evidently strips all the CC 
information from the original mail, so I lose context of who was involved in a particular 
conversation.

If I forward the mail as an attachment instead of directly, I can open the attachment and 
it will show the proper CC headers. But, for obvious reasons, I'd prefer not to have to 
use attachments for every email I respond to. Before anyone asks, I don't have 
administrative power over Exchange, so I can't do this the normal (sane) way by just 
adding an external recipient to my exchange acct.

What I need to do is parse my incoming mail, and essentially re-form the message in its 
original format with the From and CC headers as they appear in the original mail (the 
attachment). Has anyone done anything like this before? I'm not at all familiar with 
procmail but I can hack my way around in Perl or Python for scripting, so I was hoping to 
set up some combination of procmail and/or a script that can salvage the proper CC 
headers. I know procmail is pretty powerful but I don't know if this is appropriate to do 
with procmail or an external script.

I've got an example message I can forward anyone that wants to see what it looks like in 
raw form (don't want it posted to the list for spam/privacy reasons). Any tips, pointers 
or assistance you can provide would be great.

Thanks,

-Jay



More information about the Ale mailing list