zubrag.com
Free php and cpanel scripts to automate your daily routine

Free PHP Scripts :: cPanel Email Forwarder Creator

Create email forwarders on cPanel based hosting. No need to login to cPanel. Provide cPanel login and password once, and use this script each time you need to create email forwarder.

Can be run in either way:
- Parameters passed via URL (see example below)
- If no parameters passed via URL then will show email forwarder parameters entry form

Usage:
  • Update script with your cPanel login, password, skin (once)
  • When running script to create email forwarder, provide following data:
    • Username - create email forwarder for this username(sample: john)
    • Domain - create email forwarder for this domain (sample: mysite.com)
    • Redirect to - forward emails to address (sample: jimm@site2.com)

Sample parameters passing via url:
cpanel_email_forwarder.php?euser=john&edomain=site1.com&eforward=johny@site2.com

Download cPanel Email Forwarder Creator


Comments

August 5, 2000
Does anyone know of a similar script that will allow editing of existing forwarders?
Joseph Redfern March 17, 2007
Thankyou very much for this exellent script :)
networkofemail.com July 14, 2007
We just downloaded the other one for creating email addresses and thought we were out of luck for creating forwarded emails.

If this works - "BLESS YOU".

Bless you even if it doesn't.
networkofemail.com July 14, 2007
Wow.
It worked!

Again, thanks and bless you.
alanterra September 5, 2007
And thank you from a user in Oakland, CA
smallfish September 12, 2007
I can't do the forwarding. I'm getting this: The forwarder could not be added because the form was not complete.
allthingsband September 17, 2007
I am getting the same error: The forwarder could not be added because the form was not complete.

Thoughts?
zubrag [anti-spam] dheepend.com November 14, 2007
You are awesome! Been looking for something like this for a while. THANKS!
meltedmedia December 3, 2007
I was also getting the following error: "The forwarder could not be added because the form was not complete."

I think this is related to either cPanel 11 or the x3 theme or both. Regardless of this the problem is because cPanel has more forwarding options, the script is now looking for the field 'fwdemail' rather than 'forward' so you need to change the fopen line of the script so it reads: $f = fopen ("http://$cpuser:$cppass@$cpdomain:2082/frontend/$cpskin/mail/doaddfwd.html?email=$eemail&domain=$edomain&fwdemail=$eforward", "r");

The script to delete a forwarder may need a similar change, although I've not checked yet.
thiagavelinoster [anti-spam] gmail.com March 4, 2008
Hi,

frontend/x3/mail/doaddfwd.html?email=&domain=&fwdemail=

Creat. :)

All email sent to y will now be copied to x
March 28, 2008
I had to add a variable fwdopt

frontend/x3/mail/doaddfwd.html?email=&domain=&fwdopt=&fwdemail=

Then it worked great, I asked my host if I could edit forwarders & email from my own form, they told me no. IN THEIR FACE! Thanks
March 28, 2008
oh I had to make fwdopt=fwd

doaddfwd.html?email=$euser&domain=$edomain&fwdopt=fwd&fwdemail=$eforward
nandana August 20, 2008
Just what I'm looking for! Thanks.
earthtechnology [anti-spam] gmail.com January 8, 2009
Is there any script to delete the email forwarder.
naveen_chandu111 [anti-spam] yahoo.co.in January 28, 2009
$request2 = "/frontend/x3/mail/dodelfwd.html?email=$emailidwhichisforwarded%3d$currentforwarding&emaildest=$currentforwarding";


for deleting email
www.mufidun.tk April 7, 2010
what a good script bro....!!!
oremano3 [anti-spam] gmail.com May 8, 2010
This is an excellent article, thank you very much for it
Sweden July 9, 2010
Hi!
I have used this script earlier but now when im starting to use it again it dosent work (i have cpanel 11)

i was testing following without any result:
$f = fopen
("http://$cpuser:$cppass@$cpdomain:2082/frontend/x3/mail/doaddfwd.html?email=$euser&domain=$edomain&fwdopt=fwd&fwdemail=$eforward",
"r");

anyone know??

Thanks...
realestate.buyersandinvestors.com September 4, 2010
Sweden,

The author has never updated this script to work with anything else but the cpanel "x" theme.

It will not work with the "x3" theme.

I'd like to find a script like this that would work with any theme...

http://realestate.buyersandinvestors.com
hsmsmeil [anti-spam] live.cn June 22, 2011
Excellent article, thanks very much for this information. http://www.designerhandbagsoutletus.com/
henbody [anti-spam] gmail.com September 21, 2011
the email forwarder on x3 theme is using $_POST not $_GET
La madonna puttana February 2, 2012
PORCO DIO! CON CPANEL 11 UNCE' VERSO DI FALLO FUNZIONA'!
James November 16, 2012
Found this solution... replace the open line with the following:

https://$cpuser:$cppass@$cpdomain:2083/frontend/$cpskin/mail/doaddfwd.html?email=$euser&domain=$edomain&fwdemail=$eforward&fwdopt=fwd&submit=Add Forwarder
James November 16, 2012
Sorry, I should have been more specific.

This is for cpanel 11.

Was (line 87):
..."http://$cpuser:$cppass@$cpdomain:2082/frontend/$cpskin/mail/doaddfwd.html?email=$euser&domain=$edomain&forward=$eforward"...

with:
..."https://$cpuser:$cppass@$cpdomain:2083/frontend/$cpskin/mail/doaddfwd.html?email=$euser&domain=$edomain&fwdemail=$eforward&fwdopt=fwd&submit=Add Forwarder"...

Also, to remove forwarder use:

https://$cpuser:$cppass@$cpdomain:2083/frontend/$cpskin/mail/dodelfwd.html?email=".$euser."%40".$edomain."&emaildest=$eforward

Works slick!

I assume a number of the other functions offered here are going to follow along the same updated format.
James November 16, 2012
You will still get an error (even though it does work), so update the following:

line 102:

if (ereg ("failure", $text, $out) || !strpos($text,"redirected")) {
die('Cannot create email forwarding.' . $text);
}

with:

if (ereg ("failure", $text, $out) || !strpos($text,"will now be copied to")) {
die('Cannot create email forwarding.<b>' . $text);
}

it fails because its looking for the response of "redirected".

Cpanel 11 now says "will be copied to"

Also, if you are deleting the forward as I mentioned above, update "will be copied to" to "will no longer be forwarded to"

Hope this helps!
adrian_close [anti-spam] yahoo.com December 19, 2015
This needs to protect users from having their emails forwarded by someone other than themselves. I suggest including an individual key or password for the email to be forwarded. Of course, this would mean every address created should be stored in a database along with a unique key or password.
May 25, 2016
its not working with me.
oso.inno [anti-spam] yahoo.es August 14, 2016
i love ZUBRAG
cupertinoc [anti-spam] hotmail.com September 1, 2020
Thank you. Replace the word "ereg" in line 102 with preg_match in order to make it work with php 7.3 and up.