当前位置: 首页>>代码示例>>PHP>>正文


PHP Email::connect方法代码示例

本文整理汇总了PHP中Email::connect方法的典型用法代码示例。如果您正苦于以下问题:PHP Email::connect方法的具体用法?PHP Email::connect怎么用?PHP Email::connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Email的用法示例。


在下文中一共展示了Email::connect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addUser

    public function addUser($data)
    {
        $vData = $data;
        $validation = Validation::factory($vData);
        $validation->rule('username', 'not_empty');
        $validation->rule('username', 'email');
        if (!$validation->check()) {
            $this->errors = $validation->errors('userErrors');
            return FALSE;
        }
        $pass = Arr::get($data, 'pass');
        $username = addslashes(Arr::get($data, 'username'));
        $myuser = ORM::factory('Myuser');
        $auth = Auth::instance();
        $pass = $auth->hash($pass);
        //Создаем пользователя
        $myuser->username = $username;
        $myuser->email = $username;
        $myuser->password = $pass;
        $myuser->name = addslashes(Arr::get($data, 'name'));
        $myuser->phone = addslashes(Arr::get($data, 'phone'));
        try {
            $myuser->save();
            //Узнаем id пользователя
            $add_user_id = ORM::factory("user", array("username" => $username))->id;
            $token = substr($auth->hash($add_user_id . $username), 0, 20);
            //добавляем роль пользователя
            $model_addrole = new Model_Addrole();
            $model_addrole->user_id = $add_user_id;
            $model_addrole->role_id = Arr::get($data, "role");
            $model_addrole->save();
            //добавляем запись для активации
            $model_addtoken = new Model_Addtoken();
            $model_addtoken->user_id = $add_user_id;
            $model_addtoken->token = $token;
            $model_addtoken->save();
            //отправляем пользователю сообщение для авторизации
            $config = Kohana::$config->load('email');
            $mbase = new Model_Base();
            $options = $mbase->getOptions();
            Email::connect($config);
            $to = $username;
            $subject = 'Добро пожаловать на сайт ' . $options['sitename'];
            $from = $config['options']['username'];
            $message = '<b>Отправитель</b>: ' . Kohana::$base_url . '<br>';
            $message .= 'Для работы с заказами на сайте Вам необходимо активировать учетную запись. <br>
                        <br>
                        Ваш логин:  ' . $username . '<br>
                        Ваш пароль: ' . Arr::get($data, 'pass') . '<br><br>

                        Для активации перейдите по <a href="' . Kohana::$base_url . 'registration?token=' . $token . '&user=' . $username . '">этой ссылке</a>
                        <hr>
                        Спасибо за то, что пользуетесь услугами нашего сайта. По всем вопросам обращайтесь в техподдержку: ' . $config['options']['username'];
            $res = Email::send($to, $from, $subject, $message, $html = TRUE);
            return $add_user_id;
        } catch (ORM_Validation_Exception $e) {
            $this->errors = $e->errors('validation');
            return false;
        }
    }
开发者ID:chernogolov,项目名称:blank,代码行数:60,代码来源:User.php

示例2: action_index

 public function action_index()
 {
     $view = View::factory('forgot_password');
     $this->template->content = $view->render();
     if ($this->request->method() === Request::POST) {
         $email = $this->request->post('email');
         $user = new Model_User();
         $password_recovery = new Model_Password_Recovery();
         $unique_email = $user->unique_email($email);
         if ($unique_email === true) {
             throw new Exception("Email is not correct!");
         }
         $view_for_message = View::factory('forgot_password/send_email');
         $user_id = $user->get_id($email);
         $hash = sha1(Security::token());
         $view_for_message->user_id = $user_id;
         $view_for_message->hash = $hash;
         $create_attemp = $password_recovery->create_attemp($email, $user_id, $hash);
         if (!$create_attemp) {
             throw new Exception("Cannot create attemp!");
         }
         Email::connect();
         $to = array($email);
         $from = array('user@localhost', 'admin');
         $subject = 'Password recovery';
         $message = $view_for_message->render();
         $send_email = Email::send($to, $from, $subject, $message, true);
         if (!$send_email) {
             throw new Exception("Cannot send email! \n {$send_email}");
         }
         $this->redirect('/');
     }
 }
开发者ID:reGative,项目名称:Phorumph,代码行数:33,代码来源:Password.php

示例3: action_index

 public function action_index()
 {
     $this->template->head = 'Registration';
     if (Auth::instance()->logged_in()) {
         $this->redirect('message');
     } else {
         if ($post = $this->request->post()) {
             try {
                 $checkusername = ORM::factory('User')->where('username', '=', $this->request->post('username'))->find()->as_array();
                 $checkemail = ORM::factory('User')->where('email', '=', $this->request->post('email'))->find()->as_array();
                 if (!empty($checkusername['username'])) {
                     $data['errorsignin'] = 'You are entered an existing username';
                 } elseif (!empty($checkemail['email'])) {
                     $data['errorsignin'] = 'You are entered an existing email!';
                 } elseif ($this->request->post('password') !== $this->request->post('password_confirm')) {
                     $data['errorsignin'] = 'You are not confirm your password';
                 } else {
                     $user = ORM::factory('User')->create_user($_POST, array('username', 'email', 'password'));
                     $user->add('roles', ORM::factory('Role', array('name' => 'login')));
                     $config = Kohana::$config->load('email');
                     Email::connect($config);
                     $to = $this->request->post('email');
                     $subject = 'Message from Kohana!';
                     $from = 'forzaosa4@gmail.com';
                     $message = "Congratulations. You have successfully registered<br>" . "Login: " . $this->request->post('username') . "<br>Password: " . $this->request->post('password');
                     Email::send($to, $from, $subject, $message, $html = true);
                     $this->redirect("login");
                 }
             } catch (ORM_Validtion_Exception $e) {
                 $errors = $e->errors('models');
             }
         }
         $this->template->content = View::factory('reg', $data);
     }
 }
开发者ID:Osa32,项目名称:OSAplus.home,代码行数:35,代码来源:Reg.php

示例4: action_registration

 public function action_registration()
 {
     Request::initial()->is_ajax() || die;
     $emailsignup = ORM::factory('User')->checkUser('email', $this->request->post('emailsignup'));
     $usernamesignup = ORM::factory('User')->checkUser('username', $this->request->post('usernamesignup'));
     if ($emailsignup->loaded() || $usernamesignup->loaded()) {
         if ($emailsignup->loaded()) {
             $message[0]['text'] = "User with this email is already exist!";
             $message[0]['item'] = "emailsignup";
             $message[0]['status'] = "error";
         }
         if ($usernamesignup->loaded()) {
             $message[1]['text'] = "User with username email is already exist!";
             $message[1]['item'] = "usernamesignup";
             $message[1]['status'] = "error";
         }
         die(json_encode($message));
     }
     $token = md5(time() . $this->request->post('usernamesignup') . $this->request->post('emailsignup'));
     $data = array('username' => $this->request->post('usernamesignup'), 'email' => $this->request->post('emailsignup'), 'password' => $this->request->post('passwordsignup'), 'password_confirm' => $this->request->post('passwordsignup_confirm'), 'token' => $token);
     $user = ORM::factory('User')->create_user($data, array('username', 'email', 'password', 'token'));
     $url = URL::site(NULL, TRUE) . 'approved?token=' . $token;
     $config = Kohana::$config->load('email');
     $from = $config['email'];
     $to = $this->request->post('emailsignup');
     $subject = "Registration approval";
     $text = "Thank you for registration on our site! You must follow this link to activate your account: " . $url;
     Email::connect($config['main']);
     Email::send($to, $from, $subject, $text, $html = false);
     $message[0]['text'] = "Link to activate your account sent for your email";
     $message[0]['item'] = "emailsignup";
     $message[0]['status'] = "ok";
     die(json_encode($message));
 }
开发者ID:qlsove,项目名称:chat,代码行数:34,代码来源:Authorization.php

示例5: action_email

 public function action_email()
 {
     if (count($this->request->post())) {
         $hostname = $this->request->post('email_hostname');
         $port = $this->request->post('email_port');
         $username = $this->request->post('email_username');
         $password = $this->request->post('email_password');
         $encryption = $this->request->post('email_encryption');
         $email_address = $this->request->post('email_address');
         try {
             $config = $this->_create_email_config($hostname, $port, $username, $password, $encryption);
             // email_address
             if (strlen($email_address)) {
                 try {
                     Email::connect($config);
                     Email::send($email_address, $email_address, "Beans Email Verification", "You can ignore this email - it was a self-generated message " . "used to verify your email server credentials.", FALSE);
                 } catch (Exception $e) {
                     return $this->_view->send_error_message("An error occurred when verifying your email settings: " . $e->getMessage());
                 }
             }
             Session::instance('native')->set('config_email', $config);
             $this->request->redirect('/install/auth');
         } catch (Exception $e) {
             $this->_view->send_error_message($e->getMessage());
         }
     }
 }
开发者ID:rrsc,项目名称:beansbooks,代码行数:27,代码来源:install.php

示例6: action_restore

 public function action_restore()
 {
     $message = false;
     $hash = $this->request->param('id');
     $query = DB::query(Database::SELECT, 'SELECT `id` FROM `users` WHERE `restore` = "' . $hash . '" AND DATEDIFF(NOW(), `restore_date`) <= 1')->execute();
     $result = $query->as_array();
     if ($hash and $result) {
         if (!empty($_POST)) {
             if ($_POST['password_confirm'] == $_POST['password']) {
                 if (strlen($_POST['password']) >= 6 and strlen($_POST['password']) <= 50) {
                     try {
                         $user = ORM::factory('user')->where('id', '=', $result[0]['id'])->find();
                         $user->change_password($_POST);
                         $message_body = sprintf(__('forgottent.restore_message'), $_POST['password']);
                         $mailer = Email::connect();
                         $message = Swift_Message::newInstance()->setSubject(__('forgotten.subject'))->setFrom('weadmin@artonit.ru')->setTo($user->email)->setBody($message_body, 'text/html;');
                         $mailer->send($message);
                         DB::query(Database::UPDATE, 'UPDATE `users` SET `restore` = NULL, `restore_date` = NULL WHERE `email` = "' . $user->email . '"')->execute();
                         $message = array('text' => __('forgotten.email_send'), 'type' => 'success');
                     } catch (Kohana_Exception $e) {
                         $message = array('text' => __('forgotten.email_send_error'), 'type' => 'danger');
                     }
                 } else {
                     $message = array('text' => __('error.password_is_short'), 'type' => 'danger');
                 }
             } else {
                 $message = array('text' => __('error.password_not_equal'), 'type' => 'danger');
             }
         }
         $this->template->content = View::factory('admin/auth/restore')->set('message', $message);
     } else {
         Request::factory('err/404')->send_headers()->execute();
     }
 }
开发者ID:artsec,项目名称:test1,代码行数:34,代码来源:auth.php

示例7: action_process_user_payments

 public function action_process_user_payments()
 {
     // уведомляем пользователей, у которых осталось мало времени пользования аккаунтом
     $disable_event_period = DB::select('days')->from('payment_settings')->where('status', '=', 'N')->where('system_name', '=', 'disable_event_period')->limit(1)->execute()->get('days');
     if (empty($disable_event_period)) {
         $disable_event_period = 5;
     }
     $date = new DateTime();
     $date->modify($disable_event_period - 1 . " days");
     $exp = ORM::factory('user')->where(DB::expr('DATE(expires)'), '=', $date->format("Y-m-d"));
     $exp->reset(FALSE);
     if (count($exp->find_all()) > 0) {
         Email::connect();
         $exp_date = $date->format("d.m.Y");
         $title = "Действие вашего аккаунта заканчивается";
         $text = "Добрый день, %s.<br><br>Действие вашего аккаунта заканчивается %s.<br>Вы можете продлить аккаунт в <a href='http://www.as-avtoservice.ru/cabinet/payment'>личном кабинете</a>";
         foreach ($exp->find_all() as $e) {
             Email::send($e->email, array('no-reply@as-avtoservice.ru', 'Ассоциация автосервисов'), $title, sprintf($text, $e->username, $exp_date), TRUE);
             echo "date: " . $exp_date . " email: " . $e->email . "\n";
         }
     }
     //  1) ставим статус просрочен всем
     $payment_expires_period = DB::select('days')->from('payment_settings')->where('status', '=', 'N')->where('system_name', '=', 'payment_expires_period')->limit(1)->execute()->get('days');
     if (empty($payment_expires_period)) {
         $payment_expires_period = 5;
     }
     $date = new DateTime();
     $date->modify("-" . $payment_expires_period . " days");
     DB::update("invoice")->set(array('status' => 'E'))->where('status', '=', 'N')->where('create_date', '<', $date->format("Y-m-d"))->execute();
     $date = new DateTime();
     //  Вимикаєм користувачів з просроченими кабінетами
     $query = DB::update("users")->set(array('user_type' => 'disabled'))->where_open()->where('expires', '<', $date->format("Y-m-d"))->or_where('expires', '=', NULL)->where_close()->execute();
 }
开发者ID:Alexander711,项目名称:naav1,代码行数:33,代码来源:cron.php

示例8: _execute

 protected function _execute()
 {
     if (!isset($this->_data->email)) {
         throw new Exception("Please provide a valid email address.");
     }
     $user = ORM::Factory('user')->where('email', 'LIKE', $this->_data->email)->find();
     if (!$user->loaded()) {
         throw new Exception("Login error: that email address was not found.");
     }
     if (isset($this->_data->resetkey) && strlen($this->_data->resetkey)) {
         if (!isset($this->_data->password) or !strlen($this->_data->password)) {
             throw new Exception("Please provide a valid password.");
         }
         if ($user->reset != $this->_data->resetkey) {
             throw new Exception("Invalid reset key.  Please try sending the email again.");
         }
         if ($user->reset_expiration < time()) {
             throw new Exception("Reset key expired.  Please try sending the email again.");
         }
         $user->reset = NULL;
         $user->reset_expiration = NULL;
         $user->password_change = FALSE;
         $user->password = $this->_beans_auth_password($user->id, $this->_data->password);
         // And auto-login...
         $expiration = $user->role->auth_expiration_length != 0 ? time() + $user->role->auth_expiration_length : rand(11111, 99999);
         // Generate a random for salt.
         $user->auth_expiration = $expiration;
         $user->save();
         return (object) array("auth" => $this->_return_auth_element($user, $expiration));
     } else {
         // Generate Key
         $user->reset = $this->_generate_reset($user->id);
         $user->reset_expiration = time() + 10 * 60;
         $user->save();
         // This is the one email we send from within the app for security.
         $auth_print_reset = new View_Auth_Print_Reset();
         $auth_print_reset->user = $user;
         $message = Swift_Message::newInstance();
         $message->setSubject('BeansBooks Password Reset')->setFrom(array($this->_beans_setting_get('company_email') ? $this->_beans_setting_get('company_email') : 'no-reply@beansbooks.com'))->setTo(array($user->email));
         $auth_print_reset->swift_email_message = $message;
         $message = $auth_print_reset->render();
         try {
             if (!Email::connect()) {
                 throw new Exception("Could not send email. Does your config have correct email settings?");
             }
             if (!Email::sendMessage($message)) {
                 throw new Exception("Could not send email. Does your config have correct email settings?");
             }
         } catch (Exception $e) {
             throw new Exception("An error occurred when sending the email: have you setup email properly in config.php?");
         }
     }
     return (object) array();
 }
开发者ID:rrsc,项目名称:beansbooks,代码行数:54,代码来源:reset.php

示例9: send

 /**
  * Send an email message.
  *
  * @param   string|array  recipient email (and name), or an array of To, Cc, Bcc names
  * @param   string|array  sender email (and name)
  * @param   string        message subject
  * @param   string        message body
  * @param   boolean       send email as HTML
  * @param   array         attachments: filenames or arrays of name, content
  * @return  integer       number of emails sent
  */
 public static function send($to, $from, $subject, $message, $html = FALSE, $attachments = NULL)
 {
     // Connect to SwiftMailer
     Email::$mail === NULL and Email::connect();
     // Determine the message type
     $html = $html === TRUE ? 'text/html' : 'text/plain';
     // Create the message
     $message = Swift_Message::newInstance($subject, $message, $html, 'utf-8');
     if (is_string($to)) {
         // Single recipient
         $message->setTo($to);
     } elseif (is_array($to)) {
         if (isset($to[0]) and isset($to[1])) {
             // Create To: address set
             $to = array('to' => $to);
         }
         foreach ($to as $method => $set) {
             if (!in_array($method, array('to', 'cc', 'bcc'))) {
                 // Use To: by default
                 $method = 'to';
             }
             // Create method name
             $method = 'add' . ucfirst($method);
             if (is_array($set)) {
                 // Add a recipient with name
                 $message->{$method}($set[0], $set[1]);
             } else {
                 // Add a recipient without name
                 $message->{$method}($set);
             }
         }
     }
     if (is_string($from)) {
         // From without a name
         $message->setFrom($from);
     } elseif (is_array($from)) {
         // From with a name
         $message->setFrom($from[0], $from[1]);
     }
     if (!empty($attachments)) {
         foreach ($attachments as $attach) {
             if (is_array($attach)) {
                 //Create the attachment with your data
                 $message->attach(Swift_Attachment::newInstance($attach['content'], $attach['name'], File::mime_by_ext($attach['name'])));
             } else {
                 //attachments by path
                 $message->attach(Swift_Attachment::fromPath($attach));
             }
         }
     }
     return Email::$mail->send($message);
 }
开发者ID:slacker,项目名称:kohana-email,代码行数:63,代码来源:email.php

示例10: action_restore_pass

 public function action_restore_pass()
 {
     $model = array();
     $model["error"] = "";
     $model["success"] = "";
     if ($_POST) {
         $vData = $_POST;
         $validation = Validation::factory($vData);
         $validation->rule('email', 'not_empty');
         // валидация пройдена
         if ($validation->check()) {
             $email = $_POST["email"];
             $user = DB::select()->from('users')->where('email', '=', $email)->execute()->current();
             // Пользователь зарегистрирован
             if ($user) {
                 $model_user = new Model_User();
                 // Создаём новый пароль
                 $auth = Auth::instance();
                 $pass = $model_user->generate_pass();
                 $hash_pass = $auth->hash($pass);
                 DB::update("users")->set(array("password" => $hash_pass))->where("email", "=", $email)->execute();
                 //отправляем пользователю сообщение для восстановления пароля
                 $config = Kohana::$config->load('email');
                 $mbase = new Model_Base();
                 $options = $mbase->getOptions();
                 Email::connect($config);
                 $to = $email;
                 $subject = 'Восстановление пароля на ' . $options['sitename'];
                 $from = $config['options']['username'];
                 $message = '<h2>Мы создали вам новый пароль для входа на <a href="' . Kohana::$base_url . '">' . $options['sitename'] . '</a>!</h2><hr>';
                 $message .= '<h3>Ваши реквизиты для входа:<h3>';
                 $message .= '<p><small>Логин:&nbsp;&nbsp;<input type="text" value="' . $email . '"></small></p>';
                 $message .= '<p><small>Пароль:&nbsp;<input type="text" value="' . $pass . '"></small></p>';
                 $message .= '<hr>Спасибо за то, что пользуетесь услугами нашего портала. По всем вопросам обращайтесь в техподдержку: ' . $config['options']['username'];
                 Email::send($to, $from, $subject, $message, $html = true);
                 $model["success"] = '<div class="alert alert-success"><p>На ваш эл. ящик отправлены инструкции по восстановлению пароля.</p></div>';
                 // Пользователь не зарегистрирован
             } else {
                 $model["error"] .= '<div class="alert alert-danger"><p>Данный адрес эл. почты не зарегистрирован.</p></div>';
             }
             // Валидация не пройдена
         } else {
             $model["error"] .= '<div class="alert alert-danger"><p>Вы не ввели адрес эл. почты</p></div>';
         }
     }
     $this->title('Забыли пароль?');
     $this->page_title('Забыли пароль?');
     $this->keywords('Забыли пароль?');
     $this->description('Забыли пароль?');
     $this->render('user/cabinet/restore_pass.php', $model, "response");
 }
开发者ID:chernogolov,项目名称:blank,代码行数:51,代码来源:User.php

示例11: action_send

 public function action_send()
 {
     $config = Kohana::$config->load('email');
     Email::connect($config);
     $to = $_POST['to'];
     $subject = $_POST['subject'];
     $from = Kohana::$config->load('site.email');
     $message = $_POST['content'];
     $saveemail = $_POST['saveemail'];
     $date = $_POST['date'];
     if ($saveemail == 1) {
         ORM::factory('email')->set('to', $to)->set('subject', $subject)->set('from', $from)->set('message', $message)->set('date', $date)->save();
     }
     Email::send($to, $from, $subject, $message, $html = TRUE);
 }
开发者ID:raku,项目名称:front-cms,代码行数:15,代码来源:email.php

示例12: reg

 public function reg($name, $pass, $role)
 {
     PC::debug(array($name, $pass, $role), "reg");
     $myuser = new Model_Myuser();
     $auth = Auth::instance();
     $hash_pass = $auth->hash($pass);
     //Создаем пользователя
     $myuser->username = $name;
     $myuser->email = $name;
     $myuser->password = $hash_pass;
     try {
         $myuser->save();
         //Узнаем id пользователя
         //$usertmp = ORM::factory('user', array('username'=>$name));
         $adduserid = DB::select()->from('users')->where('username', '=', $name)->execute()->as_array()[0]["id"];
         $adduser = new Model_Addrole();
         $adduser->user_id = $adduserid;
         $adduser->role_id = $role;
         $adduser->save();
         //добавляем запись для активации
         $token = substr($auth->hash($adduserid . $name), 0, 20);
         $addtoken = new Model_Addtoken();
         $addtoken->user_id = $adduserid;
         $addtoken->token = $token;
         $addtoken->save();
         //отправляем пользователю сообщение для авторизации
         $config = Kohana::$config->load('email');
         $mbase = new Model_Base();
         $options = $mbase->getOptions();
         Email::connect($config);
         $to = $name;
         $subject = 'Добро пожаловать на сайт ' . $options['sitename'];
         $from = $config['options']['username'];
         $message = '<h2>Вы успешно зарегистрировались на сайте <a href="' . Kohana::$base_url . '">' . $options['sitename'] . '</a>!</h2><hr>';
         $message .= '<p>Перед входом пожалуйста подтвердите свою учётную запись, для этого перейдите по <a href="' . Kohana::$base_url . 'user/activate?token=' . $token . '&user=' . $name . '">этой ссылке</a>.</p><hr>';
         $message .= '<h3>Ваши реквизиты для входа:<h3>';
         $message .= '<p><small>Логин:&nbsp;&nbsp;<input type="text" value="' . $name . '"></small></p>';
         $message .= '<p><small>Пароль:&nbsp;<input type="text" value="' . $pass . '"></small></p>';
         $message .= '<hr>Спасибо за то, что пользуетесь услугами нашего портала. По всем вопросам обращайтесь в техподдержку: ' . $config['options']['username'];
         Email::send($to, $from, $subject, $message, $html = true);
         return true;
     } catch (ORM_Validation_Exception $e) {
         $this->errors = $e->errors('validation');
         return false;
     }
 }
开发者ID:chernogolov,项目名称:blank,代码行数:46,代码来源:Register.php

示例13: mail_send

 public function mail_send($to, $from, $subject, $message)
 {
     $email_config = Kohana::$config->load("email");
     $res = Email::connect($email_config);
     if (!Email::send($to, $from, $subject, $message, $html = true)) {
         $model_base = new Model_Base();
         $options = $model_base->getOptions();
         $to = $options['admin_email'];
         $subject = 'Ошибки на сайте ' . $options['sitename'];
         $from = $email_config['options']['username'];
         foreach ($this->errors as $error) {
             $message = '<h2>Ошибка</h2>';
             $message .= $error;
             $message .= ' <em>Отправлено: ' . date("G:i:s M j Y") . '</em>';
         }
         Email::send($to, $from, $subject, $message, $html = true);
     }
 }
开发者ID:chernogolov,项目名称:blank,代码行数:18,代码来源:Pushes.class.php

示例14: action_index

 public function action_index()
 {
     $email = Security::xss_clean(Arr::get($this->post, 'email', ''));
     $user = ORM::factory('User')->where('email', '=', $email)->find();
     if ($user->loaded() && $user->network_reg == 0 && empty($user->link_activate)) {
         $date = date("Y-m-d H:i:s");
         $code = md5($date . $user->password);
         Email::connect();
         Email::View('reminderapi');
         Email::set(array('username' => $user->username, 'id' => $code, 'url' => URL::media($this->language . '/auth/recovery/', true)));
         Email::send($user->email, array('no-reply@e-history.kz', 'e-history.kz'), "E-history.kz, ссылка для смены пароля.", '', true);
         $save_code = ORM::factory('User', $user->id);
         $save_code->link_recovery = $code;
         $save_code->save();
         $this->data = true;
     } else {
         $this->data['error'] = 'Email is not registered';
     }
     $this->response->body(json_encode($this->data));
 }
开发者ID:HappyKennyD,项目名称:teest,代码行数:20,代码来源:Passwordrecovery.php

示例15: action_step3

 public function action_step3()
 {
     $this->checkInstalled();
     $data = array();
     $data['values'] = array();
     $values = Arr::extract($_POST, array('hostname', 'username', 'password', 'port', 'timeout', 'localDomain', 'systemEmail', 'myemail'));
     if ($this->isPressed('btnSubmit')) {
         $smtpconf = Session::instance()->get('smtpconf');
         if (!empty($smtpconf)) {
             Request::initial()->redirect('install/done.html');
         }
         $data['needCheck'] = TRUE;
     }
     if ($this->isPressed('btnCheck')) {
         $smtpconf = array('driver' => 'smtp', 'options' => array('hostname' => $values['hostname'], 'username' => $values['username'], 'password' => $values['password'], 'port' => $values['port'], 'timeout' => $values['timeout'], 'localDomain' => $values['localDomain']), 'systemEmail' => $values['systemEmail']);
         try {
             $time = date('d.m.Y H:i:s', time());
             $email = Arr::get($_POST, 'myemail');
             $from = array($values['systemEmail'], 'Администратор');
             $subject = 'Проверка настроек SMTP сервера';
             $message = "Поздравляем !\n";
             $message .= "Вы получили это сообщение, отправленное в {$time}, значит настройки SMTP сервера правильные.\n";
             $message .= "Перейдите на страницу установки образовательной системы и нажмите кнопку 'Продолжить'\n";
             Email::connect($smtpconf);
             $sent = Email::send($email, $from, $subject, $message, FALSE);
             if ($sent == 0) {
                 throw new Exception('Error sending email message.');
             }
             Session::instance()->set('smtpconf', $values);
             $data['time'] = $time;
         } catch (Exception $e) {
             $data['SMTPerror'] = TRUE;
         }
     }
     $data['values'] = $values;
     $this->setBody('install/step3', $data);
 }
开发者ID:reznikds,项目名称:Reznik,代码行数:37,代码来源:install.php


注:本文中的Email::connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。