catalyst2 community forums  

Go Back   catalyst2 community forums > Support > Scripting Support

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
Old 05-08-2008, 03:00 AM   #1 (permalink)
Registered User
 
Join Date: Oct 2007
Posts: 3
On receiving an email, execute a script

Is it possble using the linux servers at catalyst2 to execute a script - (PHP ?) when an email is received?

We currently received an email to say a particular action has occured. I would like to pick up on these emails, parse the header and then insert some data into our database. I don't want to do anything with the other email which may come into the mbox.

Any help would be greatfully received.
Neil Redway is offline   Reply With Quote
Old 05-08-2008, 09:41 AM   #2 (permalink)
Bring me your problems :p
 
paulredpath's Avatar
 
Join Date: Jan 2003
Location: /dev/ahhhhhhhhh
Posts: 3,537
Neil,

You can pipe a mailbox to a script in cpanel, just under the forwarder settings.
paulredpath is offline   Reply With Quote
Old 07-08-2008, 10:56 PM   #3 (permalink)
Registered User
 
Join Date: Oct 2007
Posts: 3
That is great. I didn't spot that earlier.

So my next question is, what information do I have at my finger tips when I indicate that i want to run a script?

Do I get a reference to the mail as a file, or do I have reference to the email stream? I am not sure what to expect here.
Is there any examples of processing mail using a script running from a forwarder?
Neil Redway is offline   Reply With Quote
Old 07-08-2008, 11:01 PM   #4 (permalink)
Registered User
 
Join Date: Oct 2007
Posts: 3
Actually, I have just found the answer to my question. I am posting it here so that others can maybe find it useful:

http://www.mollerus.net/tom/blog/200..._with_php.html
http://www.willmaster.com/blog/perl/...o-a-script.php

The simple answer is that the content of the mail is available from stdin.
Neil Redway is offline   Reply With Quote
Old 08-08-2008, 08:24 AM   #5 (permalink)
Bring me your problems :p
 
paulredpath's Avatar
 
Join Date: Jan 2003
Location: /dev/ahhhhhhhhh
Posts: 3,537
Neil,

Excellent, sorry didn't spot this sooner
paulredpath is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 11:46 AM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.