On Tue, 2001-11-20 at 18:49, Ashley M. Kirchner wrote:
> 
>     I'm trying to find a solution where I can take an incoming email and
> have something, an external program, parse the data as it arrives and
> pipe the necessary information through to a database, say MySQL...
> Basically we receive orders over the net and every order placed
> generates an email.  That email I would like to parse, extract the
> necessary information and shove it into a database, automatically, with
> no user interaction.  (such script I will write of course)

This is a relatively easy job for procmail.  By default, if you're
running Sendmail and have procmail installed, all you need to do is
create a .procmailrc and you're off to the races.

Here's a trivial rule that I use to maintain a cyclical backup of all
messages that procmail processes:

# Create a backup cache of 100 most recent messages in case of mistakes
:0 c
backup

  :0 ic
  | cd backup && rm -f dummy `ls -t msg.* | sed -e 1,100d`

Obviously, you can put your script into the "cd backup" part of the
script.  You'd likely want to file your orders into a folder, and then
process them with your script.  If anything goes wrong, you've still got
the original in the backup folder.  I just created the Mail/backup
directory and it's been working fine.

Go to http://www.procmail.org for more info and samples.

-- 
Ed Wilts, Mounds View, MN, USA
mailto:[EMAIL PROTECTED]



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to