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.

api2 addforwarder problems

Discussion in 'cPanel Developers' started by kjg, Aug 9, 2011.

Thread Status:
Not open for further replies.
  1. kjg

    kjg Well-Known Member

    Joined:
    Mar 2, 2004
    Messages:
    147
    Likes Received:
    0
    Trophy Points:
    16
    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. 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
    When you encounter that problem ,does anything come up in the error_log?
     
  3. cPanelRuth

    cPanelRuth Registered
    Staff Member

    Joined:
    Mar 21, 2013
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    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.
     
Loading...
Thread Status:
Not open for further replies.

Share This Page