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

  • 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:

Download cPanel Email Forwarder Creator


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
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.

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


Creat. :)

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


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

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
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

anyone know??

realestate.buyersandinvestors.com September 4, 2010

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...

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
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):

..."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:


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);


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.