32 users online (1 members and 31 guests)  


  Results 1 to 3 of 3

Related

  1. Problem with mail-script    Forum: PHP Forum
    Replies: 0
  2. Redirect after animation    Forum: Javascript Forum
    Replies: 0
  3. Php Mail script being Spammed    Forum: PHP Forum
    Replies: 7
  4. js redirect    Forum: Javascript Forum
    Replies: 2
  5. php mail script help    Forum: PHP Forum
    Replies: 14
  1. #1
    tunde's Avatar
    New User

    Status
    Offline
    Join Date
    Nov 2009
    Posts
    1

    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

  2. #2
    jthayne's Avatar

    Status
    Offline
    Join Date
    Aug 2008
    Location
    Texas
    Posts
    508

    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.

  3. #3
    deepak229's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2010
    Posts
    1

    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.