bubba88

Registered
Jun 28, 2002
3
0
151
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 [email protected] 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
 

Elena

Well-Known Member
Aug 10, 2001
109
0
316
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
 

bubba88

Registered
Jun 28, 2002
3
0
151
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??
 

h2oski

Well-Known Member
Dec 12, 2001
68
0
306
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
 

moronhead

Well-Known Member
Aug 12, 2001
706
0
316
Try this including the quotes:

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

Substitute username with the real account name.
 

bubba88

Registered
Jun 28, 2002
3
0
151
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???
 

Elena

Well-Known Member
Aug 10, 2001
109
0
316
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