4 * hMailserver password driver
6 * @version 1.3 - 05.11.2010
7 * @author Roland 'rosali' Liebl <myroundcube@mail4us.net>
11 function password_save($curpass, $passwd)
13 $rcmail = rcmail::get_instance();
15 if ($curpass == '' || $passwd == '')
16 return PASSWORD_ERROR;
19 $remote = $rcmail->config->get('hmailserver_remote_dcom', false);
21 $obApp = new COM("hMailServer.Application", $rcmail->config->get('hmailserver_server'));
23 $obApp = new COM("hMailServer.Application");
25 catch (Exception $e) {
26 write_log('errors', "Plugin password (hmail driver): " . trim(strip_tags($e->getMessage())));
27 write_log('errors', "Plugin password (hmail driver): This problem is often caused by DCOM permissions not being set.");
28 return PASSWORD_ERROR;
31 $username = $rcmail->user->data['username'];
32 if (strstr($username,'@')){
33 $temparr = explode('@', $username);
34 $domain = $temparr[1];
37 $domain = $rcmail->config->get('username_domain',false);
39 write_log('errors','Plugin password (hmail driver): $rcmail_config[\'username_domain\'] is not defined.');
40 write_log('errors','Plugin password (hmail driver): Hint: Use hmail_login plugin (http://myroundcube.googlecode.com');
41 return PASSWORD_ERROR;
43 $username = $username . "@" . $domain;
46 $obApp->Authenticate($username, $curpass);
48 $obDomain = $obApp->Domains->ItemByName($domain);
49 $obAccount = $obDomain->Accounts->ItemByAddress($username);
50 $obAccount->Password = $passwd;
52 return PASSWORD_SUCCESS;
54 catch (Exception $e) {
55 write_log('errors', "Plugin password (hmail driver): " . trim(strip_tags($e->getMessage())));
56 write_log('errors', "Plugin password (hmail driver): This problem is often caused by DCOM permissions not being set.");
57 return PASSWORD_ERROR;