Welcome Guest | Login

reflecting email into a script

Hi, I'd like to be able to send an email and have a script receive the contents.

Something like:http://blog.viget.com/tech/2006/10/06/smart-application-messaging-the-email-reflector/

see also this site


so, does this look doable? or am I going to have to rig up something to check pop email?

2007-04-03 03:58 PM

This certainly is doable -- you want to do it with php and not a Rails app?  
http://wiki.rubyonrails.com/rails/pages/HowToReceiveEmailsWithActionMailer

Regardless, you don't have to mess around with pop.  You can create the "| /path/to/script" mail alias in your cPanel (create a forwarder) and have a script handle the email automatically.

2007-04-03 04:33 PM

William,

Thanks for the speedy reply! I'm trying to set up a simple proof of concept, but I think I need some more direction

I set up this forwarder in cpanel:
txt@suburbly.com  "| /home/suburbl/public_html/mail/process.sh"  

process.sh just puts data piped to in into a text file:
***
suburbl@luther [~/public_html/mail]# pwd
/home/suburbl/public_html/mail
suburbl@luther [~/public_html/mail]# ls -lah
total 12K
drwxr-xr-x   2 suburbl suburbl 4.0K Apr  4 11:20 ./
drwxr-x---  29 suburbl nobody  4.0K Apr  3 16:56 ../
-rwxr-xr-x   1 suburbl suburbl   56 Apr  3 17:25 process.sh*
suburbl@luther [~/public_html/mail]# cat process.sh
#!/bin/bash
read whatcamein
echo $whatcamein > received

suburbl@luther [~/public_html/mail]# echo "foo" | /home/suburbl/public_html/mail/process.sh
suburbl@luther [~/public_html/mail]# ls
./  ../  process.sh*  received
suburbl@luther [~/public_html/mail]# cat received
foo
***

I send a mail to txt@suburbly.com, but nothing happens. Advice?

2007-04-04 11:31 AM

I may have spoke too soon!

I tried it again, and this time i got a bounced message. apparently it barfed on line 3 of my script. why? duh, i didn't specify the absolute path to the output file.

set the absolute path, sent a mail, got a text file with the first line of the mail.

sweet. thanks!

2007-04-04 11:59 AM


Hello Guest! In order to post you must be an active client with us, please log in or sign up today!