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.

api autoresponder

Discussion in 'cPanel Developers' started by jcorreia, Feb 23, 2010.

  1. jcorreia

    jcorreia Well-Known Member

    Joined:
    Apr 25, 2005
    Messages:
    53
    Likes Received:
    0
    Trophy Points:
    6
    Hi,
    I´am giving the first steps with the API so I can build a form to some users add an autoresponder.

    I´ve seen the documentation here ApiEmail < ApiDocs < TWiki

    and didn´t find no reference to 'addautoresponder' nor 'delautoresponder'.
    I´ve found across search here http://forums.cpanel.net/f42/xml-api-php-class-version-1-0-a-136449-p2.html#post609885 that the add option exists in API1, although it´s not documented.

    Is this correct ? What is the function and arguments to remove it ?

    Thanks
     
  2. jcorreia

    jcorreia Well-Known Member

    Joined:
    Apr 25, 2005
    Messages:
    53
    Likes Received:
    0
    Trophy Points:
    6
    nobody ?
    There isn´t a function to remove an autoresponder ??
     
  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
    There is, it's called Email::delautoresponder

    This is an API1 call, that uses the email address as it's only parameter.

    f.ex.


    <cpanel Email="delautoresponder($FORM{'email'})">

    or in xml-api:

    cpanel?cpanel_xmlapi_apiversion=1&cpanel_xmlapi_module=Email&cpanel_xmlapi_func=delautoresponder&arg-0=someemailaddress@domain.com
     
  4. jcorreia

    jcorreia Well-Known Member

    Joined:
    Apr 25, 2005
    Messages:
    53
    Likes Received:
    0
    Trophy Points:
    6
    thank you :)
     
  5. jcorreia

    jcorreia Well-Known Member

    Joined:
    Apr 25, 2005
    Messages:
    53
    Likes Received:
    0
    Trophy Points:
    6
    APi documentation would be more helpful if it could permit user comments....php.net style ;)

    just a suggestion...
     
  6. jcorreia

    jcorreia Well-Known Member

    Joined:
    Apr 25, 2005
    Messages:
    53
    Likes Received:
    0
    Trophy Points:
    6
    found a bug in delautoresponder.
    Even it the auto responder is not deleted it always returns success.

    Here is the array return on an error

    Code:
    array
      'module' => string 'Email' (length=5)
      'func' => string 'delautoresponder' (length=16)
      'type' => string 'event' (length=5)
      'source' => string 'internal' (length=8)
      'apiversion' => string '1' (length=1)
      'data' => 
        array
          'result' => 
            array
              empty
      'event' => 
        array
          'result' => string '1' (length=1)
    
    
    The error in my case was that I was not sending the full email. Just the part until the @. It was not deleted in cpanel, but the result returned is success.

    I have the last cpanel stable version.

    Thanks
     
  7. 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
    Changes are coming to API1 in future versions that will fix this type of issue. We are aware of the problem and are working on it :)
     
  8. jcorreia

    jcorreia Well-Known Member

    Joined:
    Apr 25, 2005
    Messages:
    53
    Likes Received:
    0
    Trophy Points:
    6
    bug if comma in message of autoresponder

    Hi,
    Found a Major bug with addautoresponder. If there is any comma in the message it won´t work. I almost went nuts because it was working sometimes, and others don´t

    This is what I´ve tried
    Code:
    $args =array($email_account,
                 "TESTES",
                 "Out of Office - %subject%",
                 "for any subject please contact my colleague  yyyyyyy (zzzz.zzzz@xxxxx.com)",
                 $email_domain,
                 true,
                 "ISO-8859-1",
                 8
                );
    $result=$xmlapi->api1_query($account, "Email", "addautoresponder",$args);
    var_dump($result);
    
    this works, but if you change the message to
    "for any subject, please contact my colleague yyyyyyy(zzzz.zzzz@xxxxx.com)"

    It won´t create the autoresponder (notice the comma after the 'subject')

    I was finishing development when I found this, so I´m stuck.

    Any workaround or a way to fix this ?

    Thanks
     
  9. jcorreia

    jcorreia Well-Known Member

    Joined:
    Apr 25, 2005
    Messages:
    53
    Likes Received:
    0
    Trophy Points:
    6
    This is what is sent in the html,

    arg-3=for+any+subject%2C+please+contact+my+colleague++yyyyyyy+%28zzzz.zzzz%40xxxxx.com%29

    so I suppose there is a problem when %2C is in the message.
    I wonder if there are more special chars problems...
     
  10. nelwa

    nelwa Registered

    Joined:
    Jul 21, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    What is the property of "TESTES" and 8 in your example, I cannot find the docs for addautoresponder anywhere...

    Thanks
     
  11. nelwa

    nelwa Registered

    Joined:
    Jul 21, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    I can confirm the above mentioned bug. If a , (comma) is entered in the subject, the action fails.
     
  12. jcorreia

    jcorreia Well-Known Member

    Joined:
    Apr 25, 2005
    Messages:
    53
    Likes Received:
    0
    Trophy Points:
    6
    Hi,
    "TEstes" is the $from and '8' is the interval.

    You can check the details about this fields, in the cpanel autoresponder form.

    You didn´t find the documentation because there is none, I´ve discovered this reading the forums and struggling a lot ;)


    I Wish someone from cpanel comment about this bug and roadmap for the fix.
     
  13. jcorreia

    jcorreia Well-Known Member

    Joined:
    Apr 25, 2005
    Messages:
    53
    Likes Received:
    0
    Trophy Points:
    6
    another thing, I didn´t tested the comma in the 'subject'.
    The 'subject' I mentioned is part of the 'message body', so you have found another bug, and I suspect this bug is spread along the API for all functions,
    so this is very important for cpanel staff to check.

    Thanks
     
  14. jcorreia

    jcorreia Well-Known Member

    Joined:
    Apr 25, 2005
    Messages:
    53
    Likes Received:
    0
    Trophy Points:
    6
    For someone who cares I´ve build a workaround for it, that is to cut all the commas in the message in the xmlapi.php
    It´s not pretty, but at least it will not fail to build the autoresponder.

    add this :
    Code:
    //workaround to comma fix of autoresponder
                   $args= str_replace("%2C","",$args);
    //workaround end
    
    after this
    Code:
    $args = http_build_query($vars, '', '&');
    
    in line 587
     
  15. reyoli

    reyoli Registered

    Joined:
    Jul 7, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    I am struggling with exactly the same problem. I am pretty much a beginner, is there any easier "workaround" then the above mentioned?

    Thanks
     
Loading...

Share This Page