[CentOS] Receive, process and send email

Mon Sep 21 16:37:59 UTC 2009
Alan Hodgson <ahodgson at simkin.ca>

On Sunday 20 September 2009, "CSB" <kjcsb at xnet.co.nz> wrote:
> We wish to do the following:
> 1. receive an email with an attachment
> 2. process the email body to get some information from it
> 3. send an outbound email to an email address based on the information
> derived from step 2. The email will include the attachment received in
> step 1
>
> I'm not sure where to start with this one so any suggestions would be
> appreciated.

If it's a minor amount of processing, you can just pipe it to a script from 
procmail or even straight from the MTA. I don't really like that mechanism 
though - too prone to produce bounces in the case of long processing times 
or errors. It's better to dump them in a Maildir and use it as a queue for 
a polling script.

Perl in particular has a bunch of libraries available to correctly parse 
MIME messages and extract addresses and attachments and stuff. Don't write 
your own parser.

-- 
"No animals were harmed in the recording of this episode. We tried but that 
damn monkey was just too fast."