Mobile app version of vmapp.org
Login or Join
Yeniel560

: How to easily delete all email forwarders in cPanel? I know that I can import a list of email forwarders using CPanel, but how can I delete a list? I want to manage 300+ addresses - as

@Yeniel560

Posted in: #BulkEmail #Cpanel #Email

I know that I can import a list of email forwarders using CPanel, but how can I delete a list? I want to manage 300+ addresses - as a membership list for my organization. I want to be able to delete that many without clicking 'Delete' and then 'Confirm' (or whatever it is) 300 times. Even if I am able to simply delete ALL forwarders, then upload a modified list - that's fine with me.

Note:
I'm using a shared hosting package through SiteGround. The tech service rep informed me that I can't use CPanel scripts in a shared environment. Any suggestions?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Yeniel560

2 Comments

Sorted by latest first Latest Oldest Best

 

@Martha676

I finally discovered that email forwarders can be downloaded and restored as a text file using cPanel's Backup Manager -> Create Backup page.

In that page you can download a list of forwarders for a given domain. The list comes down as a gzipped text file. The filename of this thing is important. It is (at least on my host) alias-<domain>.gz.

You can unpack, edit, and repack this file. The format is simple: one forwarding rule per line. A forwarding rule is a source email address, a colon, then comma-separated list of target email addresses. So that

fubar@gmail.com : snafu@gmail.com, tarfu@comcast.net


forwards FUBAR's stuff to SNAFU and TARFU.

Edit this file to your heart's content. Create a new one with a completely different set. Whatever. As long as your source email addresses are in the proper domain, you are in the clear.

Zip it back up, and make sure your new gzip file has the exact same filename as the original you downloaded. Then use the Create Backup Page to restore the backup by uploading your altered gzip. Voilá!

10% popularity Vote Up Vote Down


 

@Bethany197

There may well be simpler solutions available, but I myself would write a script that uses the cPanel XML/JSON API to retrieve the list of forwarders, then loop through them and systematically delete all that I found unnecessary. Though, at that point, I suppose you might as well write a script that would allow you to manage the whole shebang outside of cPanel...

Anyway, it looks like API 2's Email Module contains methods for acquiring a list of forwarders and adding them, while API 1's Email Module has a call to delete all of the forwarders associated with a particular domain as well as one to delete individual forwarders, so it may be necessary to use a combination of the two to achieve the desired result.

Hope that helps!

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme