Ejemplo n.º 1
0
 /**
  * 测试邮件发送
  */
 public function actionMailTest()
 {
     $data = $this->_gets->getParam('Config');
     try {
         $var['state'] = 'success';
         $var['message'] = '发送成功';
         XMail::send();
         var_dump($data);
     } catch (Exception $e) {
         $var['state'] = 'error';
         $var['message'] = '错误:' . $e->getMessage();
     }
     exit(CJSON::encode($var));
 }
Ejemplo n.º 2
0
 function save($currpass, $newpass)
 {
     $rcmail = rcmail::get_instance();
     list($user, $domain) = explode('@', $_SESSION['username']);
     $xmail = new XMail();
     $xmail->hostname = $rcmail->config->get('xmail_host');
     $xmail->username = $rcmail->config->get('xmail_user');
     $xmail->password = $rcmail->config->get('xmail_pass');
     $xmail->port = $rcmail->config->get('xmail_port');
     if (!$xmail->connect()) {
         rcube::raise_error(array('code' => 600, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, 'message' => "Password plugin: Unable to connect to mail server"), true, false);
         return PASSWORD_CONNECT_ERROR;
     } else {
         if (!$xmail->send("userpasswd\t" . $domain . "\t" . $user . "\t" . $newpass . "\n")) {
             $xmail->close();
             rcube::raise_error(array('code' => 600, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, 'message' => "Password plugin: Unable to change password"), true, false);
             return PASSWORD_ERROR;
         } else {
             $xmail->close();
             return PASSWORD_SUCCESS;
         }
     }
 }