Koozali.org: home of the SME Server

Legacy Forums => Experienced User Forum => Topic started by: Michael Doerner on October 09, 2000, 02:36:30 PM

Title: automated processing of incoming emails?
Post by: Michael Doerner on October 09, 2000, 02:36:30 PM
Hi,

We need to set up a mail server at a client site and I would like to use e-smith for that job. We need to be able to automate incoming emails (for one account) for EDI (order processing) which will be probably about the following procedure:

- storing the attachment(s) (or mail body, don't know exactly yet) into a specific directory,
- create log file entry about that email (when processed, sender's adress, etc.),
- trigger another program to process the contents of that directory (maybe I should do that with a cron job?)

Can I do that just with qmail or what else will be needed (procmail)?

Anybody doing something similar and willing to share some ideas/knowledge?

Kind Regards,
Michael Doerner
Title: RE: automated processing of incoming emails?
Post by: Scott Smith on October 09, 2000, 11:02:18 PM
Michael

I'm doing something similar with sendmail. I added a new delivery agent to sendmail, then updated rule set 0 to intercept local messages of a certain format and send them to the new delivery agent. That delivery agent (which is actually a Korn shell script in our case, but you could use Perl, C, etc) examines the message and determines how to process it based on the recipient name. It was relatively easy to setup sendmail.cf once I understood it (the "bat" book from O'Reilly was helpful for that) and to program the Korn script.

An example: Messages come into sendmail destined for "customer.###" where ### is an ID number. Rule set zero, in the section that has determined the address is for local delivery, has a new rule added that looks for "customer.$+" and passes the message to a new MDA named "customer" for processing. This MDA actually invokes a "custproc" script and passes the recipient name, which allows custproc to determine what subprogram to call based on the ### portion of the name. There is nothing to prevent custproc from also checking for other headers or even the body of the message.

You might be able to do something similar on qmail, though I don't know that much about how qmail implements rules and MDAs. From what I've read of procmail, that should work as well.

Best of luck!

Scott