"...Remember being a youngster, mom or dad telling you "close the door"? Well the same applies to HTML ...."

Go Back   Webmaster Forums > Code Forum > CGI Perl Forum

Reply
 
Thread Tools Rate this Webmaster Discussion
Old 11-19-2009, 03:39 AM   #1
tunde
New Member
 
Join Date: Nov 2009
Webmaster Discussions: 1
Rep Power: 5
tunde is on a distinguished road
Post read incoming mail and redirect to php script

Hi, i am working on a project. i need to read every incoming mail sent to an email address. this mail will be redirected to a php code for processing. do anyone has any idea how to i can write this code in cgi.
thanks


tunde is offline   Reply With Quote
Old 11-20-2009, 06:04 PM   #2
jthayne
 
jthayne's Avatar
 
Join Date: Aug 2008
Location: Texas
Webmaster Discussions: 501
Rep Power: 21
jthayne is the hardest working person in the biz.jthayne is the hardest working person in the biz.jthayne is the hardest working person in the biz.jthayne is the hardest working person in the biz.
Re: read incoming mail and redirect to php script

You can do this using Exim and procmail. Check with your server administrator to find out how to use an Exim script on your server.

For example, I have the following .procmailrc file on one of the sites I have developed that processes a specific format of email and redirects those emails to a PHP script:

Code:
VERBOSE=off
#LOGABSTRACT=yes
SENDMAIL=/usr/sbin/sendmail
SHELL=/bin/sh
MAILDIR=$HOME/theFolder
LOGFILE=/home/*********/procmail.log
DEFAULT=$HOME/theFolder

#Get the subject discarding any leading and trailing blanks
#Note: On some systems -xSubject: has to be -x"Subject: "
SUBJ_=`formail -xSubject: \
       | expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`

:0:
* ^Subject:.*.Repair Order
{
  :0 fwh
  | formail -I"Subject: ${SUBJ_}"
  :0c:
  $DEFAULT
  :0:
  |/usr/bin/php -f /home/*******/public_html/scrape.php $LASTFOLDER
}
Then I set up a forwarder that forwards all mail sent to a specific email address to
Code:
|/usr/bin/procmail -v
It is a fun project that can get very complicated very quickly, but once it works, it is really exciting to make it so.
__________________
Be sure to click the reputation icon to give rep to the person who helped you.
For web design/development services, check Silentium Designs.
jthayne is offline   Reply With Quote
Old 03-09-2010, 10:46 PM   #3
deepak229
New User
 
Join Date: Mar 2010
Webmaster Discussions: 1
Rep Power: 3
deepak229 is on a distinguished road
Re: read incoming mail and redirect to php script

Hi, I am new to this and I need to learn how to redirect the incoming mail to a php script.

I am using LSMTP mail server, on windows server 2003. I need to know how to configure it so that, a mail coming to an email-id to a php script. Please help me out.

Last edited by deepak229; 03-09-2010 at 11:12 PM.
deepak229 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
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


Similar Webmaster Discussions
Thread Webmaster Discussion Starter Forum Replies Last Post
Problem with mail-script adamsen PHP Forum 0 09-28-2009 12:54 PM
Php Mail script being Spammed richybear PHP Forum 7 04-27-2007 06:19 AM
js redirect f&m Javascript Forum 2 02-09-2005 03:30 AM
php mail script help Derek PHP Forum 14 12-01-2003 02:23 PM
redirect advice please Webeauty Search Engine Optimization - SEO - Forum 4 09-18-2003 12:15 PM


All times are GMT -5. The time now is 09:17 PM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.