Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
Showing results for 
Search instead for 
Did you mean: 

Automate email processing

Go to solution

Automate email processing

Hi All,

Not sure if I can only do this using a list server (i.e. majordomo), but here goes...

I want to be able to receive email messages to a special alias and then process those messages via some script. The script will take data from the body and update database records based on the key info.

Anyone know of how to do this? Do you see any problems with this?
Thanks in advance,

Scott Van Kalken
Esteemed Contributor

Re: Automate email processing

I did a similar thing many years ago when I was working as a namespace admin.

We would receive emails, the emails would them be sorted, and the information in them would be stored in an SQL database.

Then we'd generate billing info from our database.

We used a bunch of perl scripts and elm mailboxes.

We used elm's sorting features to sort based on subject: "domain name renewal" went to one mailbox and so forth.

We did find though that email was not the best because people do not follow standard formats - we found in the end that a web form that updated the database directly was much easier for us to handle (less crap ending up in our database).

We used mySQL databases as an interim solution before moving to a full java backend with oracle.

Hope this helps.

Robin Wakefield
Honored Contributor

Re: Automate email processing

Hi Mike,

On your receiving server, create an alias with a pipe, e.g:

stats: "|/usr/local/bin/"

Basically the message is read as input to the pipe, so for instance if you'd sent it as a uuencoded gzipped message, you could have something like this in the script:

/usr/bin/uudecode -p | /sbclocal/bin/gunzip -c > /tmp/message.$$ 2>>/tmp/message.out


Rgds, Robin