The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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:
    1
    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:
    1
    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 cPanel Product Owner
    Staff Member

    Joined:
    Apr 29, 2005
    Messages:
    417
    Likes Received:
    1
    Trophy Points:
    18
    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
     
Loading...

Share This Page