Skip to main content

Change email account password using API 2 with reseller credentials

Comments

2 comments

  • marcochiesi
    If anyone out there is interested in this, I finally was able to find a solution (thanks also to cPanel support team). I made a modified copy of the roundcube's cpanel password driver (plugins/password/drivers/cpanel.php), anche changed the setPassword as follows: [PHP] function setPassword($address, $password) { if (strpos($address, '@')) { list($data['email">, $data['domain">) = explode('@', $address); } else { list($data['email">, $data['domain">) = array($address, ''); } $data['password"> = $password; // first get cpanel user from domain $query = $this->xmlapi->listaccts('domain', $data['domain">); $query = json_decode($query, true); if($query['status"> != 1) return false; $cpanel_user = $query['acct">[0]['user">; // then we update password $query = $this->xmlapi->api2_query($cpanel_user, 'Email', 'passwdpop', $data); $query = json_decode($query, true); if ($query['cpanelresult">['data">[0]['result"> == 1) { return true; } return false; }[/PHP] P.s. In roundcube config file you must use port 2087 and put reseller credentials for this to work.
    0
  • cPanelMichael
    I am happy to see you were able to find a solution. Thank you for updating us with the outcome.
    0

Please sign in to leave a comment.