Results 1 to 3 of 3

Thread: api2 addforwarder problems

  1. #1
    kjg
    kjg is offline
    Member
    Join Date
    Mar 2004
    Posts
    104

    Default api2 addforwarder problems

    Just want to warn you that the behaviour of
    Mail::addforwarder
    is not always what you expect

    If you try to add a forwarder with an emailadress not containing @, the forwarder is set to :fail: and all other forwarders for that domain are deleted!
    OK, you should check your input, but to delete all forwarders if there is no @ in fwdemail seems a bit hard
    ex:
    xmlapi->api2_query("testaccount", "Email", "addforward", array(domain=>'test.com',email=>'test',fwdemail=>'toadress.com',fwdopt=>'fwd') );

    That call will
    * return nothing
    * set test@test.com to :fail:
    * delete all other forwarders for test.com

    So check your fwdemail before using this

    I did this on purpose to test result codes from the API when using IDN-domains with errors, but was not expecting this behaviour ..

    Also seems that the doc is not up to date for some parts of the API such as Park:: park where setting topdomain will give an error

    But having said this, I must add that I really like the class and use it a lot. It have saved me loads of work.

    // kjg

  2. #2
    Member MattDees's Avatar
    Join Date
    Apr 2005
    Location
    Houston, TX
    Posts
    409

    Default Re: api2 addforwarder problems

    When you encounter that problem ,does anything come up in the error_log?
    Matt Dees

  3. #3
    cPanel Staff
    Join Date
    Mar 2013
    Posts
    1

    Default Re: api2 addforwarder problems

    Quote Originally Posted by kjg View Post
    Just want to warn you that the behaviour of
    Mail::addforwarder
    is not always what you expect

    If you try to add a forwarder with an emailadress not containing @, the forwarder is set to :fail: and all other forwarders for that domain are deleted!
    OK, you should check your input, but to delete all forwarders if there is no @ in fwdemail seems a bit hard
    ex:
    xmlapi->api2_query("testaccount", "Email", "addforward", array(domain=>'test.com',email=>'test',fwdemail=>'toadress.com',fwdopt=>'fwd') );

    That call will
    * return nothing
    * set test@test.com to :fail:
    * delete all other forwarders for test.com

    So check your fwdemail before using this

    I did this on purpose to test result codes from the API when using IDN-domains with errors, but was not expecting this behaviour ..

    // kjg
    I've run some tests on 11.36, and this is no longer happening at that point. (Disclaimer--I didn't test 11.34 or earlier! YMMV). It's now accepting the "bad" input without deleting other forwards. Now, that said, it's a little murky what precisely would happen if that forward were triggered--but it's not tossing out other records, at least!

    Thanks for the report!

    D Ruth Bavousett
    Integration Developer
    cPanel, Inc.

Similar Threads

  1. API2 and JSON
    By mpuk in forum cPanel Developers
    Replies: 1
    Last Post: 04-12-2011, 07:17 AM
  2. API2: addaddondomain
    By DrGonzo in forum cPanel Developers
    Replies: 1
    Last Post: 10-26-2010, 12:40 PM
  3. Use API1 and API2
    By rongup in forum cPanel & WHM Discussions
    Replies: 38
    Last Post: 02-04-2009, 10:16 AM
  4. API2 Basics?
    By mikelegg in forum cPanel Developers
    Replies: 16
    Last Post: 12-19-2008, 05:02 PM