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.

Email Forwarding to script

Discussion in 'E-mail Discussions' started by bubba88, Jul 10, 2002.

  1. bubba88

    bubba88 Registered

    Joined:
    Jun 28, 2002
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    I was told by my administrator that the Email Forwarding feature in Cpanel can be used to execute a perl script similar to symlink.

    For example I'm trying to forward the email test@testdomain.com to /home/domain/testfile.pl and at the same time the script should execute to parse the email.

    Does anyone know what I need to type into the add email forward to get this script to execute? The alias has already been set up but I need and additional statement to execute the script at the same time.

    here's what I've been putting into the 'add email forwarder':

    exec &/home/domain/testfile.pl&

    Anyone can help or have knowledge on how to do this?
    or does the server need a symlink in order for it to work?
    perhaps it is a syntax error????

    thanks a bunch
     
  2. Elena

    Elena Well-Known Member

    Joined:
    Aug 10, 2001
    Messages:
    109
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    California
    I think you just need to enter &|/home/domain/testfile.pl&
    however I've never tried it directly through cpanel.. usually edit the file manually. Give it a go... make sure the file in your account is 755 to be executable. :p
     
  3. bubba88

    bubba88 Registered

    Joined:
    Jun 28, 2002
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    I tried &|/home/domain/testfile.pl&
    does not work. Tried it without the quotes still don't work.

    Here's the original message I recieved from my administrator after I requsted a symlink from /etc/smrsh to the file /home/domain/testfile.pl

    &Please add this via the regular Cpanel email forward
    feature. Except instead of forwarding it to an email
    address, type in the command that you want executed.&

    Anyone else have insight to this??
     
  4. h2oski

    h2oski Well-Known Member

    Joined:
    Dec 12, 2001
    Messages:
    68
    Likes Received:
    0
    Trophy Points:
    6
    Just a thought, your admin told you to use /home/domain/testfile.pl

    but the format for cpanel servers is

    /home/username/testfile.pl

    the user directory is identified by username not domain.


    Just a thought
     
  5. moronhead

    moronhead Well-Known Member

    Joined:
    Aug 12, 2001
    Messages:
    706
    Likes Received:
    0
    Trophy Points:
    16
    Try this including the quotes:

    &|/usr/bin/perl /home/username/script.pl&

    Substitute username with the real account name.
     
  6. bubba88

    bubba88 Registered

    Joined:
    Jun 28, 2002
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    h2oski,

    I tried your suggestion... does not work.

    Also, the forwarder removes the space between the perl interpreter and the file location.

    I know it's not working yet for two reasons:

    1) no errors in the log file
    2) the database is empty

    Anyone else???
     
  7. Elena

    Elena Well-Known Member

    Joined:
    Aug 10, 2001
    Messages:
    109
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    California
    Go to the backup section of the control panel where you can download the alias file for your domain name. Open up the file and under *: username

    enter...

    test: &|/home/username/public_html/pathto/testfile.pl&

    replace test with the email username for the address you want the mail sent to. Now save it... tar it back up and make sure you save the zip as it was when you downloaded it (not sure if this matters) alias-domain.com

    Now.. go in the cpanel and use the restore feature.. I think this can work to trick it if your host is being a lazy @$$ and not editing this file for you. Not 100% this will work.. just an idea that came to mind LOL
     
  8. itf

    itf Well-Known Member

    Joined:
    May 9, 2002
    Messages:
    624
    Likes Received:
    0
    Trophy Points:
    16
    You can’t forward email by Forwarder in cpanel to a script because it appends @domain.com to your script name

    i.e
    me@mydomain.com: |/home/path/to/test.pl

    it appends
    me@mydomain.com: |/home/path/to/test.pl@domain.com

    You have to modify /etc/valiases/domain.com to forward to a script by adding
    me@mydomain.com: |/home/path/to/test.pl
     
Loading...

Share This Page