Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

[Q] Mail Filter: Redirect to Script

Discussion in 'E-mail Discussion' started by ericgorr, Mar 20, 2004.

  1. ericgorr

    ericgorr Registered

    Joined:
    Mar 20, 2004
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    151
    The mail filter docs say one can redirect e-mail to a script:

    but does not provide any further details.

    Has anyone implemented this?
    What does the shell of such a script look like?

    Is there any other documentation that goes into more detail?
     
  2. bamasbest

    bamasbest Well-Known Member

    Joined:
    Jan 10, 2004
    Messages:
    531
    Likes Received:
    0
    Trophy Points:
    166
    Actually, you "pipe" the email to a script.

    Example:

    parsethis@yourdomain.com -> | /home/user/public_html/cgi-bin/emailparser.php

    The script, in the language of your choice (as supported by your platform/install), would do all of the processing from there, depending upon your needs.
     
  3. peterr

    peterr Well-Known Member

    Joined:
    Sep 24, 2003
    Messages:
    75
    Likes Received:
    0
    Trophy Points:
    156
    Hi,

    In PHP, the shell of your script would look like this:

    PHP:
    $fd fopen("php://stdin""r");
    $email "";
    while (!
    feof($fd)) {
        
    $email .= fread($fd1024);
    }
    fclose($fd); 
    then the mail is in the var $email, and you can do what you wish with it.

    Hope that helps,

    Peter
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice