The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

processing mail in PHP

Discussion in 'E-mail Discussions' started by elck, Aug 27, 2005.

  1. elck

    elck Registered

    Joined:
    Aug 27, 2005
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Hi,
    I am trying to process some mail in PHP scripts and this is what I do now:

    I made a filter that saves mail with a subject title containing 'forum' in a cgi-bin directory.

    I run a cronjob that copies this file and changes the permissions with chmod.

    I would rather not use a cronjob, but process the mail the moment it is received.
    Is there a way to start a php script upon reception of mail?

    If this is the wrong place for this posting please don't be angry, but coul you tell me where to go?

    :)
     
  2. bpmod

    bpmod Well-Known Member

    Joined:
    Sep 23, 2004
    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    6
    It took me 18 days to get an answer to this when I first got cPanel. I hope you haven't been searching that long.

    The first thing you need to do is make sure that your script is working correctly.

    Then you need to set up a forwarder using the following syntax:

    |/bin/sh -c '/usr/bin/php /path/to/your/script.php >> /path/to/an/outputfile.txt'

    The >> and the output file are not strictly necessary, but will certainly help in debuging etc. Notice that the quotes are around everything from before /usr to after .txt as that is one argument passed to the shell (/bin/sh). I am not sure what the -c does, but it works in my forwards, so I haven't questioned or investigated it further.

    Hope this helps!

    Brian
     
    #2 bpmod, Aug 27, 2005
    Last edited: Aug 27, 2005
  3. elck

    elck Registered

    Joined:
    Aug 27, 2005
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Thanks Brian,

    I have tried other solutions for a while that did not please me much.
    I only started investigation this avenue a short while ago.

    Thanks for saving me the 18 days! :)


    Regards,

    Elck
     
Loading...

Share This Page