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.

Email API functions

Discussion in 'cPanel Developers' started by steelaz, Nov 11, 2008.

  1. steelaz

    steelaz Member

    Joined:
    Nov 19, 2005
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    1
    I've been playing with cpanel API and got some strange results.

    First I tried "listpopswithdisk" function and it listed my 5 email accounts.

    I went to my cPanel, deleted one of the account, it displayed remaining 4 accounts on cPanel, but running "listpopswithdisk" still showed 5 accounts (even after 10 mins).

    Then I went on creating new accounts using "addpop" API call. Got new account name as a result and "listpopswithdisk" listed new accounts, but cPanel doesn't show them and I can't access them using POP or webmail.


    Any ideas?
     
  2. steelaz

    steelaz Member

    Joined:
    Nov 19, 2005
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    1
    Tried again with email forwarders and got the same result.

    "addforward" API call is executed successfully but nothing shows up on cPanel.
    "listforwards" is listing new entry, but when I tried forwarder, it didn't work.

    Below are examples of my calls:

    /xml-api/cpanel?user=$username&xmlin=<cpanelaction><module>Email</module><func>addforward</func><args><fwdemail>$fwdemail</fwdemail><fwdopt>$fwdopt</fwdopt><domain>$domain</domain><email>$email</email></args></cpanelaction>

    /xml-api/cpanel?user=$username&xmlin=<cpanelaction><module>Email</module><func>listforwards</func><args><domain>$domain</domain></args></cpanelaction>

    Below is result for "listforwards" call:
    Code:
      <cpanelresult>
        <apiversion>2</apiversion>
        <data>
          <dest>apitest@domain.com</dest>
          <forward>personal@gmail.com</forward>
          <html_dest>apitest@domain.com</html_dest>
          <html_forward>personal@gmail.com</html_forward>
    
          <uri_dest>apitest%40domain.com</uri_dest>
          <uri_forward>personal%40gmail.com</uri_forward>
        </data>
        <func>listforwards</func>
        <module>Email</module>
    
      </cpanelresult>
    
     
  3. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Please provide the full version information for your cPanel/WHM server as it is likely relevant to these issues, especially the addpop issue.
     
  4. steelaz

    steelaz Member

    Joined:
    Nov 19, 2005
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    1
    WHM 11.23.2
    cPanel 11.23.6-R27698

    Thanks
     
  5. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    I know with the addpop call, there was some work done on it just prior to 11.24, but not sure if there was a fix that was applied to 11.24. I've notified QA that this issue also affects passwdpop in addition to delpop as well. (internal case 8786)

    As for addforward, are you calling this via the XML API? If so, does the XML output contain the text [an error has occurred at this directive]?
     
  6. jasonhk

    jasonhk Well-Known Member

    Joined:
    Nov 11, 2005
    Messages:
    48
    Likes Received:
    0
    Trophy Points:
    6
    addpop works fine in 11.24, will text passwdpop sometime. :)
     
  7. steelaz

    steelaz Member

    Joined:
    Nov 19, 2005
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    1
    Yes, I used XML API for all functions and got valid XML back, no mention of an error.

    I tried connecting to another server running 11.24 and everything worked fine. I'm going to upgrade my own server.

    Thanks for your help.
     
  8. jasonhk

    jasonhk Well-Known Member

    Joined:
    Nov 11, 2005
    Messages:
    48
    Likes Received:
    0
    Trophy Points:
    6
    Hey, Have you got the delpop (Delete Email Account) to work?
     
  9. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    From what I see, a fix for the issues with passwdpop and delpop has been formulated so these issues should be resolved shortly in 11.24. Keep an eye on the changelog ( http://changelog.cpanel.net ) for updates.
     
  10. jasonhk

    jasonhk Well-Known Member

    Joined:
    Nov 11, 2005
    Messages:
    48
    Likes Received:
    0
    Trophy Points:
    6
    Thanks David, will keep checking that change log :)
     
  11. TheIdeaMan

    TheIdeaMan Member

    Joined:
    Apr 25, 2005
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    Checking on delpop from XML-API

    I just recently tested the delpop API call on my cPanel server running WHM 11.23.2 cPanel 11.23.6-S27698. I receive this invalid XML back:

    Code:
    <?xml version="1.0" ?>
    <cpanelresult>
      <module>Email</module>
      <func>delpop</func>
      <type>event</type>
      <source>internal</source>
      <apiversion>1</apiversion>
      <data>
        <result>
          <fatalerror>[a fatal error or timeout occurred while processing this directive]</fatalerror>
          <fatalerror>[a fatal error or timeout occurred while processing this directive]</fatalerror>
    
    ...that's where it stops.

    My request looks like this:
    Code:
    /xml-api/cpanel?user=user&xmlin=<cpanelaction><apiversion>1</apiversion><module>Email</module><func>delpop</func><args>address</args><args>0</args><args>domain.com</args></cpanelaction>
    I've checked the change log, but didn't see any updates about the delpop problem. I don't have access to an 11.24 server to test this with, but I'd love to know if the patch for this problem is in sight--or if I've missed something.

    Thanks in advance.
     
  12. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Works for me on:
    cPanel 11.24.4-E33228 - WHM 11.24.2 - X 3.9
    CENTOS 4.7 i686 on standard

    Just remember, the address parameter is only the portion before @. If you have an @ in your address parameter, then this function call will not be successful.


    A handy note, whenever you get one of those [a fatal error or timeout occurred while processing this directive] calling an API, data about that API call and why it failed will be logged to:

    /usr/local/cpanel/logs/error_log

    tailing the log will typically provide relevant information.
     
  13. MalcotheMalc

    MalcotheMalc Registered

    Joined:
    Jan 14, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Yes this is now working for me... thanks!
     
  14. TheIdeaMan

    TheIdeaMan Member

    Joined:
    Apr 25, 2005
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    error from log

    Thanks for the logging tip. The address is merely the first part of the domain name--no '@' character in it.

    Here's what gets returned when I attempt using delpop via the XML-API:

    Code:
    (internal death while parsing [fd 0]) Wed Jan 14 09:16:49 2009 [27364] error: Can't locate object method "ToLower" via package "Cpanel::StringFunc::Match" (perhaps you forgot to load "Cpanel::StringFunc::Match"?) at /usr/lib/perl5/5.6.2/utf8_heavy.pl line 30, <QUOTA> line 1.
    	eval {...} called at /usr/lib/perl5/5.6.2/utf8_heavy.pl line 30
    	utf8::SWASHNEW('utf8', 'ToLower', undef, 4, 0) called at /usr/local/cpanel/Cpanel/StringFunc/Match.pm line 28
    	Cpanel::StringFunc::Match::ibeginmatch('otheraddress:10485760', 'address:') called at /usr/local/cpanel/Cpanel/Email.pm line 2067
    	Cpanel::Email::delpop('address', 0, 'domain.com') called at cpanel.pl line 3791
    	main::doemail('delpop', 'address', 0, 'domain.com') called at cpanel.pl line 1772
    	main::exectag('<cpanel Email="delpop(address,0,domain.com)">') called at cpanel.pl line 1547
    	main::docpanelaction('<cpanelaction><apiversion>1</apiversion><module>Email</module><f...') called at cpanel.pl line 4745
    	main::dotag(undef) called at cpanel.pl line 4620
    	main::cpanel_parseblock('SCALAR(0x9268cb0)') called at cpanel.pl line 1297
    
    
    (internal death while parsing [fd 0]) Wed Jan 14 09:16:49 2009 [27364] error: Can't find unicode character property definition via Cpanel::StringFunc::Match->ToLower or To/Lower.pl at /usr/local/cpanel/Cpanel/StringFunc/Match.pm line 28
    	Carp::croak('Can\'t find unicode character property definition via Cpanel::St...') called at /usr/lib/perl5/5.6.2/utf8_heavy.pl line 8
    	utf8::croak('Can\'t find unicode character property definition via Cpanel::St...') called at /usr/lib/perl5/5.6.2/utf8_heavy.pl line 30
    	utf8::SWASHNEW('utf8', 'ToLower', undef, 4, 0) called at /usr/local/cpanel/Cpanel/StringFunc/Match.pm line 28
    	Cpanel::StringFunc::Match::ibeginmatch('otheraddress:10485760', 'address:') called at /usr/local/cpanel/Cpanel/Email.pm line 2067
    	Cpanel::Email::delpop('address', 0, 'domain.com') called at cpanel.pl line 3791
    	main::doemail('delpop', 'address', 0, 'domain.com') called at cpanel.pl line 1772
    	main::exectag('<cpanel Email="delpop(address,0,domain.com)">') called at cpanel.pl line 1547
    	main::docpanelaction('<cpanelaction><apiversion>1</apiversion><module>Email</module><f...') called at cpanel.pl line 4745
    	main::dotag(undef) called at cpanel.pl line 4620
    	main::cpanel_parseblock('SCALAR(0x9268cb0)') called at cpanel.pl line 1297
    
    
    Can't find unicode character property definition via Cpanel::StringFunc::Match->ToLower or To/Lower.pl at /usr/local/cpanel/Cpanel/StringFunc/Match.pm line 28
    
    I'd love to see this fixed in Stable as our sys admin prefers to stick with it over Edge (as cool as Edge is, I'm sure).

    Thanks again.

    P.S. There are no Unicode characters in my address or domain name.
     
    #14 TheIdeaMan, Jan 14, 2009
    Last edited: Jan 14, 2009
  15. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Ahh, I know that error all too well myself. Once STABLE goes to 11.24, that should go away.
     
  16. TheIdeaMan

    TheIdeaMan Member

    Joined:
    Apr 25, 2005
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    It did. :) Thanks so much for all the work you do. cPanel 11.24 is excellent.

    I'm now running cPanel 11.24.4-S33345 and everything XML-API works flawlessly. Great job to all who were apart of 11.24's release (and for cPanelDavidG's great forum help).
     
    #16 TheIdeaMan, Jan 20, 2009
    Last edited: Jan 20, 2009
Loading...

Share This Page