Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

How to remove an e-mail forward using API?

Discussion in 'cPanel Developers' started by webspaceinc, Feb 18, 2010.

  1. webspaceinc

    webspaceinc Registered

    Joined:
    Feb 18, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    51
    I'm using the xmlapi.php class and referencing ApiEmail < ApiDocs < TWiki for function calls. I've implemented listing, creation, and deletion of pop accounts as well as creation of an e-mail forwarding account (Email::addforward).

    I am having trouble deleting the forward using the API as I don't see a specific call referenced in the documentation.

    I've tried delpop and deletefilter as well as delforward (on the off-chance it's undocumented), using both v1 and v2 calls. I may be sending the wrong order of parameters or barking up the wrong tree... hard to say. Hoping to get some help here.

    cPanel version is 11.24.5-RELEASE 38506 if that is helpful / relevant.

    Thanks for any helpful hints -Matt
     
  2. webspaceinc

    webspaceinc Registered

    Joined:
    Feb 18, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    51
    Upgraded to 11.25, no dice

    I've upgraded to 11.25.0-RELEASE Build 43470 and rewrote these calls to use the JSON calling method.

    I found some references to deleting forwards in another post (set local and remote addresses to match?), but still have had no success. I really would appreciate some assistance and believe I have done due diligence in researching the documentation and forums.

    One oddity I found is that calling addforward using v2 resulted in a success message, but no creation of the forward. It's only when using v1 that addforward seems to work using JSON. I am happy to post sample code if this generates any interest.

    I appreciate any assistance others might be able to provide.
     
  3. MattDees

    MattDees Well-Known Member

    Joined:
    Apr 29, 2005
    Messages:
    416
    Likes Received:
    1
    Trophy Points:
    243
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Looks like the syntax for delforward is (as an API1 call):

    Email::delfoward("$address=$forwarder")

    $address = the incoming email address
    $forwarder = destination email address

    Tracer Output:
    Code:
    email:delforward
    $apiv = 1
    $type = post
    -----
    $cfgref
    
    $VAR1 = {
              'param0' => 'address@cptest.com=forwarder@cptest.com'
            };
    

    For what you're doing you may want to use the API call tracer as it allows you to see API calls realtime in the error_log: http://sdk.cpanel.net/utils/CustomEventHandler-Dumper.tar.gz
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice