Community Forums
Connect with us on LinkedIn
  
+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 16
  1. #1
    Member
    Join Date
    Apr 2006
    Posts
    29

    Default Email prob

    Hey guys,
    I created a comunaty website that has a custome made webmail systeme integrated into it. Everytime a member registers, an email account is created.

    Works greate ... but i am facing a problem.

    I don't know why, but seems there's a lot of pepol using the "Lost my password" option. Works great for the website but how can i make it change the email account at the same time with out knowing the old pass.

  2. #2
    Member
    Join Date
    Nov 2008
    Posts
    76

    Default

    You can login to your cpanel account and under email>>Email Accounts, you can see the option to change password for each account. You can enter the new password and there is no need to specify the old password to reset.
    Regards,
    Jay J,
    HostingZoom | ResellerZoom |
    modVPS

  3. #3
    Member
    Join Date
    Apr 2006
    Posts
    29

    Default

    ummm lol ? i don't wana be mean hzJayJ but this is the developper forum ... of course i ment using php to do it

  4. #4
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by PHPEcono View Post
    ummm lol ? i don't wana be mean hzJayJ but this is the developper forum ... of course i ment using php to do it
    You would need to change the primary contact email on the account prior to somehow triggering the reset password function. The reset password function does not have an API counterpart that I am currently aware of.

  5. #5
    Member
    Join Date
    Apr 2006
    Posts
    29

    Default

    This is what i am working on

    $postfields = "email=" . $_POST['email'] . "&domain=" . $domain . "&password=" . $_POST['password1'] . '&quota=1';
    $popPost = curl_init();
    $url = "http://" . $username . ":" . $password . "@" . $domain . ":2082/frontend/" . $theme . "/mail/dopasswdpop.html?" . $postfields;
    curl_setopt($popPost, CURLOPT_URL, $url);
    curl_setopt($popPost, CURLOPT_POST, 1);
    curl_setopt($popPost, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($popPost, CURLOPT_TIMEOUT, 15);
    $popPost_result = curl_exec ($popPost);
    curl_close ($popPost);

    $start = strpos($popPost_result, '<b>Account');
    $end = strpos($popPost_result, '<!-- pre tag ended here -->');
    $responce = substr($popPost_result, $start, $end-$start);

  6. #6
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by PHPEcono View Post
    This is what i am working on

    $postfields = "email=" . $_POST['email'] . "&domain=" . $domain . "&password=" . $_POST['password1'] . '&quota=1';
    $popPost = curl_init();
    $url = "http://" . $username . ":" . $password . "@" . $domain . ":2082/frontend/" . $theme . "/mail/dopasswdpop.html?" . $postfields;
    curl_setopt($popPost, CURLOPT_URL, $url);
    curl_setopt($popPost, CURLOPT_POST, 1);
    curl_setopt($popPost, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($popPost, CURLOPT_TIMEOUT, 15);
    $popPost_result = curl_exec ($popPost);
    curl_close ($popPost);

    $start = strpos($popPost_result, '<b>Account');
    $end = strpos($popPost_result, '<!-- pre tag ended here -->');
    $responce = substr($popPost_result, $start, $end-$start);
    I recommend using our APIs instead of manually trying to post data to a HTML page is very likely to change.

    You would call the API2 function for changing the contact information via our XML API. You can learn more about this process at:

    http://www.cPanel.net/plugins/xmlapi

    The URL you would user is:
    Code:
    /xml-api/cpanel?user=USERNAME&xmlin=<cpanelaction><module>CustInfo</module><func>savecontactinfo</func><args><email>first@example.com</email><second_email>second@example.com</second_email><notify_disk_limit>1</notify_disk_limit><notify_bandwidth_limit>1</notify_bandwidth_limit><notify_email_quota_limit>0</notify_email_quota_limit></args></cpanelaction>
    The blue text represents the variable values. USERNAME is the cPanel username, first@example.com is the primary contact where email is sent to, second@example.com is the secondary email and the remaining settings control the notifications they receive.

    Note, leaving any of these arguments empty will result in a default value of an empty string (for strings) or 0 (for numbers) being applied.


    An alternate way of implementing the functionality you want to implement (sending a new password to someone other than the person on the account) would be to simply create a password, set it as the password via our APIs and email that password via your script.

    Note, sending passwords in plain text (such as via email) is generally considered poor security practice as plain text passwords are relatively easily intercepted while in transit.

  7. #7
    Member
    Join Date
    Apr 2006
    Posts
    29

    Default

    Hmm ... I am not sure I understand your way ... I need to change the guy’s password into the new one the user asks for after there email is checked with out any humain intervention.

    1. The user forgets his password
    2. He clicks on forget
    3. He enters his email
    4. A link with a safe md5 string is saved to the DB and sent to his email
    5. He clicks on the link
    6. The generated md5 code is compared to the one in the DB
    7. An automated temporary password is created and sent to his email. Client is auto logged and prompted to change his password.

    What I need to do is automatically change the email password to keep the one for the site synchronized with the one for the email account.

    It all needs to be done with out any human intervention...

    If that’s not possible to do at the moment, can I request that new feature for the next WHM update?

    In the mean time I guess my only way would be to manually post the data to dopasswdpop.html
    Last edited by PHPEcono; 02-05-2009 at 10:50 AM.

  8. #8
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by PHPEcono View Post
    Hmm ... I am not sure I understand your way ... I need to change the guy’s password into the new one the user asks for after there email is checked with out any humain intervention.

    1. The user forgets his password
    2. He clicks on forget
    3. He enters his email
    4. A link with a safe md5 string is saved to the DB and sent to his email
    5. He clicks on the link
    6. The generated md5 code is compared to the one in the DB
    7. An automated temporary password is created and sent to his email. Client is auto logged and prompted to change his password.

    What I need to do is automatically change the email password to keep the one for the site synchronized with the one for the email account.

    It all needs to be done with out any human intervention...

    If that’s not possible to do at the moment, can I request that new feature for the next WHM update?

    In the mean time I guess my only way would be to manually post the data to dopasswdpop.html
    Ah, webmail . I thought we were talking about mailing back the cPanel user's password.

    Setting a webmail password can be done through our APIs. As for trapping password changes performed via the webmail interface, take a look at /usr/local/cpanel/hooks/README.

    The API1 call for changing a mail password is:

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

    Note, the email parameter is simply the part of the email before @ so with someone@example.com, email would be 'someone' and domain would be 'example.com'

    password is the password and the quota is the user's email quota.

    This can be called via the XML API as described at: http://cpanel.net/plugins/xmlapi/cpanel.html

  9. #9
    Member
    Join Date
    Apr 2006
    Posts
    29

    Default

    Yeah that looks more like what i need thx :-)
    Is the quota value in KB or MB?

  10. #10
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by PHPEcono View Post
    Yeah that looks more like what i need thx :-)
    Is the quota value in KB or MB?
    The quota value is specified in MB.

  11. #11
    Member
    Join Date
    Apr 2006
    Posts
    29

    Default

    Hmm i don't get it ...

    PHP Code:
    // Change email password
    $cpusername '***';
    $cppassword '***';
    $host '***';

    $request '/xml-api/cpanel?user=$cpusername&xmlin=<cpanel Email="passwdpop('.$customers[username].'@***.***, '.$_POST[pass1].', 250, '.$host.')">';

    $ch curl_init();
    curl_setopt($chCURLOPT_SSL_VERIFYPEER,0);
    curl_setopt($chCURLOPT_SSL_VERIFYHOST,0);
    curl_setopt($chCURLOPT_RETURNTRANSFER1);
    curl_setopt($chCURLOPT_URL"http://$host:2082" $request);  
    curl_setopt($chCURLOPT_USERPWD"$cpusername:$cppassword");

    $result curl_exec($ch);  
    curl_close($ch);

    // DDDDEEEEBBBBUUUUGGGG
    $Name "***"//senders name
    $email "***"//senders e-mail adress
    $mail_body "Email debugger\n\n$result"//mail body
    $subject "Email debugger"//subject
    $header "From: "$Name " <" $email ">\r\n"//optional headerfields
    mail("***"$subject$mail_body$header); //mail command :)
    ///////////////////////////////////////////////////////////////////////////// 
    This is the error i get by email when i try using this...

    Code:
    <cpanelresult><data><result>0</result><reason>Unknown Error</reason></data></cpanelresult>
    Unknown Error ... not really helping lol

  12. #12
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by PHPEcono View Post
    Hmm i don't get it ...

    PHP Code:
    // Change email password
    $cpusername '***';
    $cppassword '***';
    $host '***';

    $request '/xml-api/cpanel?user=$cpusername&xmlin=<cpanel Email="passwdpop('.$customers[username].'@***.***, '.$_POST[pass1].', 250, '.$host.')">';

    $ch curl_init();
    curl_setopt($chCURLOPT_SSL_VERIFYPEER,0);
    curl_setopt($chCURLOPT_SSL_VERIFYHOST,0);
    curl_setopt($chCURLOPT_RETURNTRANSFER1);
    curl_setopt($chCURLOPT_URL"http://$host:2082" $request);  
    curl_setopt($chCURLOPT_USERPWD"$cpusername:$cppassword");

    $result curl_exec($ch);  
    curl_close($ch);

    // DDDDEEEEBBBBUUUUGGGG
    $Name "***"//senders name
    $email "***"//senders e-mail adress
    $mail_body "Email debugger\n\n$result"//mail body
    $subject "Email debugger"//subject
    $header "From: "$Name " <" $email ">\r\n"//optional headerfields
    mail("***"$subject$mail_body$header); //mail command :)
    ///////////////////////////////////////////////////////////////////////////// 
    This is the error i get by email when i try using this...

    Code:
    <cpanelresult><data><result>0</result><reason>Unknown Error</reason></data></cpanelresult>
    Unknown Error ... not really helping lol
    I strongly recommend you familiarize yourself with the XML API. We have documentation for the XML API on our website at:

    http://www.cPanel.net/plugins/xmlapi

    Here are a few things you should be aware of:
    • The XML API works over the WHM ports, not the cPanel ports
    • You do not append API1 and API2 tags to the end of /xml-api/ to use them. You must use the appropriate XML API function call: cpanel.
    • passwdpop(), if any parameter contains an @, then you are not using that API call properly. The email address is split into its component parts: email, domain. email is the part before @, domain is the part after @.

    For example, I want to change the password of an email account test@example.com with a 25mb quota to SomePass, I would use this if I wanted to do this from outside the cPanel interface:

    Code:
    /xml-api/cpanel?user=username&xmlin=<cpanelaction><module>Email</module><func>passwdpop</func><apiversion>1</apiversion><args>test</args><args>somepass</args><args>25</args><args>example.com</args></cpanelaction>
    Where username is the cPanel username.
    Last edited by cPanelDavidG; 02-05-2009 at 04:13 PM. Reason: Grammatical and syntax cleanup.

  13. #13
    Member
    Join Date
    Apr 2006
    Posts
    29

    Default

    hmm well i found 2 errors ... cpanel?user='.$cpusername.'
    and i was also using ***@***.*** for the username when you said to use only the part before the @

    But i still get the same problem

    <cpanelresult><data><result>0</result><reason>Unknown Error</reason></data></cpanelresult>

    The string i am using looks like
    Code:
    /xml-api/cpanel?user=***&xmlin=<cpanel Email="passwdpop(***, ***, 250, ***)">
    All the data seems to be posted the right way as provided above

    PHP Code:
    // Change email password
    $cpusername '***';
    $cppassword '***';
    $host '***';

    $request '/xml-api/cpanel?user='.$cpusername.'&xmlin=<cpanel Email="passwdpop('.$customers[username].', '.$_POST[pass1].', 250, '.$host.')">';

    $ch curl_init();
    curl_setopt($chCURLOPT_SSL_VERIFYPEER,0);
    curl_setopt($chCURLOPT_SSL_VERIFYHOST,0);
    curl_setopt($chCURLOPT_RETURNTRANSFER1);
    curl_setopt($chCURLOPT_URL"http://$host:2082" $request);  
    curl_setopt($chCURLOPT_USERPWD"$cpusername:$cppassword");

    $result curl_exec($ch);  
    curl_close($ch);

    // DDDDEEEEBBBBUUUUGGGG
    $Name "***"//senders name
    $email "***"//senders e-mail adress
    $mail_body "Email debugger\n\n$result"//mail body
    $subject "Email debugger"//subject
    $header "From: "$Name " <" $email ">\r\n"//optional headerfields
    mail("***"$subject$mail_body$header); //mail command :) 
    Last edited by PHPEcono; 02-05-2009 at 04:29 PM.

  14. #14
    Member
    Join Date
    Apr 2006
    Posts
    29

    Default

    oh sorry i missed your post hehe let me do the changes and see if that does it.

    Thx bro ;-)

  15. #15
    Member
    Join Date
    Apr 2006
    Posts
    29

    Default

    This time i get no error ... but for some reason the password of the email is not changed ...

    PHP Code:
    //////////////////////////////////////////////////////////////////////////
    // Change email password
    $cpusername 'root';
    $cppassword '***';
    $host '***';

    $request '/xml-api/cpanel?user='.$cpusername.'&xmlin=<cpanelaction><module>Email</module><func>passwdpop</func><apiversion>1</apiversion><args>'.$customers[username].'</args><args>'.$_POST[pass1].'</args><args>250</args><args>'.$host.'</args></cpanelaction>';

    $ch curl_init();
    curl_setopt($chCURLOPT_SSL_VERIFYPEER,0);
    curl_setopt($chCURLOPT_SSL_VERIFYHOST,0);
    curl_setopt($chCURLOPT_RETURNTRANSFER1);
    curl_setopt($chCURLOPT_URL"http://$host:2086" $request);  
    curl_setopt($chCURLOPT_USERPWD"$cpusername:$cppassword");

    $result curl_exec($ch);  
    curl_close($ch);

    // DDDDEEEEBBBBUUUUGGGG
    $Name "***"//senders name
    $email "***"//senders e-mail adress
    $mail_body "Email debugger\n\n$result\n\n$request"//mail body
    $subject "Email debugger"//subject
    $header "From: "$Name " <" $email ">\r\n"//optional headerfields
    mail("***"$subject$mail_body$header); //mail command :)
    ///////////////////////////////////////////////////////////////////////////// 
    One thing intresting abbou this is in the email debugger, $result is null but $request sends a valid xml-api string

    Code:
    /xml-api/cpanel?user=root&xmlin=<cpanelaction><module>Email</module><func>passwdpop</func><apiversion>1</apiversion><args>patrick</args><args>123456789</args><args>250</args><args>****</args></cpanelaction>

Similar Threads & Tags
Similar threads

  1. Strange prob regarding email encryption SSL
    By Metro2 in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 07-06-2006, 12:53 AM
  2. Stats Prob
    By jaymc in forum New User Questions
    Replies: 6
    Last Post: 04-16-2005, 12:43 AM
  3. Email prob: Failed to find group and email forward problem?
    By webcs in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 03-15-2004, 10:06 AM
  4. Email prob
    By tichosting in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 03-20-2003, 07:52 AM
  5. webalizer prob
    By AlaskanWolf in forum cPanel and WHM Discussions
    Replies: 7
    Last Post: 12-06-2002, 12:01 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube