On Sunday 20 September 2009, "CSB" kjcsb@xnet.co.nz wrote:
We wish to do the following:
- receive an email with an attachment
- process the email body to get some information from it
- 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.