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.

Create Email Account using API

Discussion in 'cPanel Developers' started by ldsuva, Jun 17, 2009.

  1. ldsuva

    ldsuva Member

    Joined:
    Mar 16, 2009
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    I have WHM access, how to create email account for the domain using API.

    Any inputs are most welcome
    Regards
    Lakha
     
  2. 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
    If you want to code in PHP 5, I recommend using Matt's PHP 5 class as it makes it much easier to use our APIs. You can find his PHP 5 class at:

    http://forums.cpanel.net/f42/xmlapi-php-class-111897.html

    The function for creating an email account is an API1 function. The raw function call as it appears in the X3 theme is:

    Code:
    <cpanel Email="addpop($FORM{'email'},$FORM{'password'},$FORM{'quota'},$FORM{'domain'})">
    The first parameter is the portion of the email address before the @ sign (e.g. nobody, if creating nobody@example.com)

    The second parameter is the password for the mail account

    The third parameter is the disk quota in megabytes (e.g. 250)

    The forth parameter is the domain this email address is for (e.g. example.com if creating nobody@example.com).
     
  3. ldsuva

    ldsuva Member

    Joined:
    Mar 16, 2009
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Edit email accounts through amlapi

    Hello Team


    From trial and forum I found command for add/delete/list email accounts but no luck with editing email username or password.

    Please help me where I can see these list of function and kindly assist me what is command to chive editing email account user name or password.

    1) $xmlapi->api1_query($account, "Email", "addpop", array($email_user, $email_password, $email_domain) );
    2) $xmlapi->api1_query($account, "Email", "delpop", array($email_user, $email_password, $email_domain) );
    3) $xmlapi->api2_query($account, "Email", "listpops","pratikplds.com" );

    Please instruct me for editing now.
    Thanks in advance
     
  4. 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
    Editing a username for an email account is not possible in the cPanel interface, so there will be no API equivalent for that.

    For editing an email account's password, you would use:

    Code:
    <cpanel Email="passwdpop(email, password, quota, domain)">
    email is the portion of the email address before @

    password is the new password for the email account.

    quota is the email quota

    domain is the portion of the email address after @
     
  5. ldsuva

    ldsuva Member

    Joined:
    Mar 16, 2009
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    what is this : <cpanel Email="passwdpop(email, password, quota, domain)">

    Hello

    I dont understand why you people not giving proper instruction.
    I wrote I am using below code to get all email account ,<?php
    $xmlapi->api2_query($account, "Email", "listpops","pratikplds.com" );
    ?>

    Now please guide me how to use below code like the one above I used.
    You are asking to raise ticket, they are saying refer forum, I dont understand the reason.

    Please instruct me how to use below code in php, like I used above for getting email accounts.

    <cpanel Email="passwdpop(email, password, quota, domain)">

    Hope This time I will get answer.
    Regards
     
  6. lvt

    lvt Well-Known Member

    Joined:
    May 23, 2009
    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Reseller Owner
    I'm not familiar with the PHP class provided here but I guess that you will need something like :

     
  7. 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
    You mentioned you submitted a ticket about this and you were referred back to the forums. If this was a ticket directly with cPanel, Inc, can you provide me with your ticket ID so I can follow up with this internally?

    lvt's post summed up what you need to do. If you need clarification for this even after reviewing the api1 example in the zip file containing the PHP 5 class, please let me know.
     
  8. ldsuva

    ldsuva Member

    Joined:
    Mar 16, 2009
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Support Request Id 445949 - API function to list email accounts

    Hello

    Please find below ID:
    Support Request Id 445949 - API function to list email accounts
    Its Joshua Brown and Mary Wior replied on ticket.

    Thanks
     
  9. vibhadevit

    vibhadevit Registered

    Joined:
    Jul 14, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    If Not WHM access then?

    Hi all,
    i have cpanel username and password but not whm.
    what can i do??
     
  10. 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
    Use the XML API over port 2082 (or port 2083 if you want to use SSL) and authenticate with your cPanel username and password.
     
  11. papageorge

    papageorge Registered

    Joined:
    Oct 21, 2009
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Hello

    What should I ask from my provider to do this?
     
  12. cPanelDon

    cPanelDon cPanel Quality Assurance Analyst
    Staff Member

    Joined:
    Nov 5, 2008
    Messages:
    2,557
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Houston, Texas, U.S.A.
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    There may not be anything specific other than ensuring you can login using your account username and password; if you can login then you should be able to attempt to access the XML-API as was previously mentioned. It couldn't hurt to try asking the service provider for assistance connecting to their system via the XML-API; they may be able to help check logs for troubleshooting and also verify the login works.

    If what you're seeking to do is similar or the same as the original poster, then you might include a link to this forums thread, or if it is different you might start a new thread to ask in more detail about what you're looking to accomplish.

    Here is our related developer documentation for additional reference material:
    WebHome < AllDocumentation/AutomationIntegration < TWiki
     
  13. ldsuva

    ldsuva Member

    Joined:
    Mar 16, 2009
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Warning using Cpanel xml API

    Hello
    Every thing was fine but recently I am getting warning using same code:

    $ip = "XX.xx.xx.xx";

    $root_pass = "******";

    $account = "test";

    $xmlapi = new xmlapi($ip);

    $xmlapi->password_auth("root",$root_pass);

    $result=$xmlapi->api2_query($account, "Email", "listpops","pratikplds.com" );


    Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : Extra content at the end of the document in

    Regards
     
Loading...

Share This Page