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


PHP Mail::to方法代码示例

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


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

示例1: testMail

 public function testMail()
 {
     $this->mail = Mail::to('jceee@foxmail.com')->from('jceee <15918797254@139.com>')->title('hehe,title des')->content("<h1>content</h1>");
     echo '<pre>';
     var_dump($this->mail);
     exit;
 }
开发者ID:jceee,项目名称:MFFC,代码行数:7,代码来源:IndexController.php

示例2: hookCommentPublished

 /**
  * Hook comment publishing
  *
  * @param object $Comment
  * @param object $Post
  * @param object $Parent
  * @param object $ParentAuthor
  */
 public function hookCommentPublished($Comment, $Post, $Parent = NULL, $ParentAuthor = NULL)
 {
     // If you post comment to your post
     if ($Post->aid != $Comment->aid) {
         $replace = array('$user_link%' => $this->user->getLink(), '%user_name%' => $this->user->getName(), '%post_link%' => $Post->getLink(), '%post_name%' => $Post->name, '%comment%' => $Comment->body, '%reply_link%' => $Post->getLink() . '#comment-' . $Comment->id);
         $mail = new Mail(array('name' => 'comment.post', 'subject' => t('New comment to your post', 'Mail.templates'), 'body' => str_replace(array_keys($replace), array_values($replace), t('User <a href="%user_link%">%user_name%</a> has published a comment to your post <a href="%post_link%">"%post_name%"</a>:
                         <p><i>%comment%</i></p>
                         <p><a href="%reply_link%">Reply &rarr;</a></p>'))));
         if ($PostAuthor = user($Post->aid)) {
             $mail->to($PostAuthor->email);
             $mail->send();
         }
     }
     /**
      * If you reply and not to yourself
      */
     if ($Parent && $Parent->aid != $this->user->id) {
         $replace = array('$user_link%' => $this->user->getLink(), '%user_name%' => $this->user->getName(), '%post_link%' => $Post->getLink(), '%post_name%' => $Post->name, '%comment%' => $Comment->body, '%reply_link%' => $Post->getLink() . '#comment-' . $Comment->id);
         $mail = new Mail(array('name' => 'comment.reply', 'subject' => t('Reply for your comment', 'Mail.templates'), 'body' => str_replace(array_keys($replace), array_values($replace), t('User <a href="%user_link%">%user_name%</a> has answered for you comment to post <a href="%post_link%">"%post_name%"</a>:
                         <p><i>%comment%</i></p>
                         <p><a href="%reply_link%">Reply &rarr;</a></p>', 'Mail.templates'))));
         $mail->to($ParentAuthor->email);
         $mail->send();
     }
     unset($mail);
 }
开发者ID:brussens,项目名称:cogear2,代码行数:34,代码来源:Gear.php

示例3: mail

 public function mail()
 {
     $mail = Mail::to(['ooxx@gmail.com', 'ooxx@qq.com'])->from('MotherFucker <ooxx@163.com>')->title('Fuck Me!')->content('<h1>Hello~~</h1>');
     if ($mail instanceof Mail) {
         $mailer = new Nette\Mail\SmtpMailer($mail->config);
         $mailer->send($mail);
     }
 }
开发者ID:badaozhai,项目名称:bdzmvc,代码行数:8,代码来源:HomeController.php

示例4: send_link

 public function send_link($id, $hash, $email)
 {
     Mail::$to = $email;
     Mail::$subject = 'registr';
     Mail::$text = '
             link: <br>' . Config::get('site_name') . 'reg/activate/' . $id . '/' . $hash;
     if (Mail::Send()) {
         echo 'send true';
         exit;
     } else {
         echo 'send false';
         exit;
     }
 }
开发者ID:serg234,项目名称:practic,代码行数:14,代码来源:reg_m.php

示例5: home

 public function home()
 {
     /*$url = parse_url($_SERVER['REQUEST_URI']);
     		$method = $_SERVER['REQUEST_METHOD'];
     		echo '<pre>';
     		var_export($method);
     		var_export($url);
     		echo '</pre>';*/
     #echo '<h1>控制器成功</h1>';
     #
     $this->view = View::make("home")->with('article', Article::first())->withTitle('MFFC : -D')->withFuckMe('OK!');
     //发邮件
     $this->mail = Mail::to(['532974019@qq.com'])->from('MontherFucker <leezhxing@163.com>')->title('hello')->content('<h1>HELLO~~~~~</h1>');
 }
开发者ID:leezhxing,项目名称:mffc,代码行数:14,代码来源:HomeController.php

示例6: beforeInsert

 function beforeInsert($db)
 {
     $event = $db->get(new Event($this->event));
     if (Variable::istype('Event', $event) && $event->isActive($db)) {
         $this->hash = crypt($this->name . time() . mt_rand(0, 9999));
         if ($this->mail) {
             $parser = new HtmlParser('thanks.mtpl');
             $parser->setVariable('participant', $this);
             $mail = new Mail('noreply@rhaco-users.jp', 'rhaco kaigi');
             $mail->to($this->mail, $this->name);
             $mail->subject('rhaco kaigi');
             $mail->message($parser->read());
             $mail->send();
         }
         return true;
     }
     return false;
 }
开发者ID:riaf,项目名称:jp.rhaco-users.kaigi,代码行数:18,代码来源:Participant.php

示例7: register_action

 /**
  * User Регистрация
  */
 public function register_action($code = NULL)
 {
     $this->theme->template('User/templates/login');
     if (!config('user.register.active', FALSE)) {
         return error(t('Регистрация отключена администрацией сайта.'));
     }
     if ($this->isLogged()) {
         return error('Вы уже авторизированы!');
     }
     $this->showMenu();
     if ($code) {
         $user = new User();
         $user->hash = $code;
         if ($user->find()) {
             $form = new Form('User/forms/verify');
             $form->email->setValue($user->email);
             if ($result = $form->result()) {
                 $user->object()->extend($result);
                 $result->realname && ($user->name = $result->realname);
                 $user->hashPassword();
                 $user->hash = $this->secure->genHash($user->password);
                 $user->reg_date = time();
                 $user->last_visit = time();
                 if ($user->save()) {
                     event('user.register', $user);
                     if ($user->login()) {
                         flash_success(t('Регистрация завершена!'));
                         redirect($user->getLink());
                     }
                 }
             }
             $form->show();
         } else {
             error(t('Регистрационный код не найден.'));
         }
     } else {
         $form = new Form('User/forms/register');
         if ($result = $form->result()) {
             $user = new User();
             $user->email = $result->email;
             $user->find();
             $user->hash = $this->secure->genHash(date('H d.m.Y') . $this->session->get('ip') . $result->email);
             if (config('user.register.verification', TRUE)) {
                 $verify_link = l('/user/register/' . $user->hash, TRUE);
                 $mail = new Mail(array('name' => 'register.verify', 'subject' => t('Регистрация на сайте %s', SITE_URL), 'body' => t('Вы успешно зарегистрировались на сайте http://%s. <br/>
                         Пожалуйста, перейдите по ссылке ниже, для того чтобы подтвердить данный почтовый ящик:<p>
                         <a href="%s">%s</a>', SITE_URL, $verify_link, $verify_link)));
                 $mail->to($user->email);
                 if ($mail->send()) {
                     $user->save();
                     event('user.confirmation', $user);
                     success(t('Письмо с подтвержденим регистрации было отправлено на почтовый адрес <b>%s</b>. Следуйте инструкциям.', $user->email));
                 }
             } else {
                 $user->save();
                 redirect(l('/user/register/' . $user->hash));
             }
         } else {
             $form->show();
         }
     }
 }
开发者ID:brussens,项目名称:cogear2,代码行数:65,代码来源:Gear.php

示例8: unset

    unset($_SESSION['pass']);
}
if (isset($_POST['pass']) && $_POST['pass1'] && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
    $_POST = trimAll($_POST);
    $_POST = m_r_e_sAll($_POST);
    $_POST = htmlAll($_POST);
    $email = $_POST['email'];
    $pass = $_POST['pass'];
    $pass1 = $_POST['pass1'];
    if ($pass == $pass1) {
        $pass = md5($pass);
        //зашифрованный пароль можно использ функцию зашифровки в default myHash
    } else {
        $_SESSION['info'] = 'Пароль не правельный';
        header("Location: ../settings.php");
    }
    if ($email == $_SESSION['user']['email']) {
        mysqli_query($connect, "UPDATE capons SET\n                              pass = '{$pass}'\n                              WHERE id = '{$coil}'\n                              ") or die(mysqli_error());
        // $id = mysqli_insert_id($connect); //функция возвращает ID последнего добавленного элемента в БД - что-бы передать ID для проверки активации
        Mail::$to = $_POST['email'];
        //класс Mail вызываеться из папка class Mail  - функцией в файле default
        Mail::$subject = 'Вы зарегестрировались на сайте';
        Mail::$text = '....Вам новый пароль:' . $_POST['pass1'];
        Mail::send();
        header("Location: ..//settings.php");
        exit;
    } else {
        $_SESSION['info'] = 'вы ввели неправельный email';
        header("Location: ../settings.php");
    }
}
开发者ID:capons,项目名称:WEB-ALL-Information,代码行数:31,代码来源:button.php

示例9: send

 /**
  * Sends the mail
  * 
  * @return bool success
  */
 public function send()
 {
     // Add registered recipient
     parent::to($this->to['email'], $this->to['name']);
     // Get sender from recipient data
     $sender = '';
     if ($this->to['object']) {
         switch (get_class($this->to['object'])) {
             case 'Recipient':
                 $sender = $this->to['object']->transfer->user->email;
                 break;
             case 'Guest':
                 $sender = $this->to['object']->user->email;
                 break;
         }
     }
     if (!$sender) {
         $sender = $this->to['email'];
     }
     // Own action
     // Context identifier
     $context = $this->to['object'] ? strtolower(get_class($this->to['object'])) . '-' . $this->to['object']->id : 'no_context';
     // Build from field depending on config
     $from = Config::get('email_from');
     if ($from) {
         if ($from != 'sender' && !filter_var($from, FILTER_VALIDATE_EMAIL)) {
             throw new ConfigBadParameterException('email_from');
         }
         if ($from == 'sender') {
             $from = $sender;
         }
         // Got one, validate and set header
         if ($from) {
             if (!filter_var($from, FILTER_VALIDATE_EMAIL)) {
                 throw new BadEmailException($from);
             }
             $from_name = Config::get('email_from_name');
             if ($from_name) {
                 $from = '"' . mb_encode_mimeheader($from_name) . '" <' . $from . '>';
             }
             $this->addHeader('From', $from);
         }
     }
     // Build reply-to field depending on config
     $reply_to = Config::get('email_reply_to');
     if ($reply_to) {
         if ($reply_to != 'sender' && !filter_var($reply_to, FILTER_VALIDATE_EMAIL)) {
             throw new ConfigBadParameterException('email_reply_to');
         }
         if ($reply_to == 'sender') {
             $reply_to = $sender;
         }
         // Got one, validate and set header
         if ($reply_to) {
             if (!filter_var($reply_to, FILTER_VALIDATE_EMAIL)) {
                 throw new BadEmailException($reply_to);
             }
             $reply_to_name = Config::get('email_reply_to_name');
             if ($reply_to_name) {
                 $reply_to = '"' . mb_encode_mimeheader($reply_to_name) . '" <' . $reply_to . '>';
             }
             $this->addHeader('Reply-To', $reply_to);
         }
     }
     // Build return path field depending on config
     $return_path = Config::get('email_return_path');
     if ($return_path) {
         if ($return_path != 'sender' && !filter_var(str_replace('<verp>', 'verp', $return_path), FILTER_VALIDATE_EMAIL)) {
             throw new ConfigBadParameterException('email_return_path');
         }
         if ($return_path == 'sender') {
             $return_path = $sender;
         }
         // Got one, validate and set property to be passed to PHP's mail internal
         if ($return_path) {
             // If verp pattern insert context so that return path alone tells which object the bounce is related to
             if (preg_match('`^(.+)<verp>(.+)$`i', $return_path, $match)) {
                 $return_path = $match[1] . $context . $match[2];
             }
             if (!filter_var($return_path, FILTER_VALIDATE_EMAIL)) {
                 throw new BadEmailException($return_path);
             }
             $this->return_path = $return_path;
         }
     }
     // Set context in headers so that it is returned along with bounces
     if ($context) {
         $this->msg_id = '<' . $context . '-' . uniqid() . '@filesender>';
         $this->addHeader('X-Notes-Context', $context);
     }
     // Send email
     return parent::send();
 }
开发者ID:eheb,项目名称:renater-foodle,代码行数:98,代码来源:ApplicationMail.class.php

示例10: template_new_gameserver_mail

 public static function template_new_gameserver_mail($param, $is_resend = false)
 {
     $param = json_decode(json_encode($param), FALSE);
     $user_name = str_replace('@gameloft.com', '', $_SERVER['REMOTE_USER']);
     $user_name = str_replace('.', ' ', ucfirst($user_name));
     //$cc[] = MAIL_MEX;
     foreach ($param as $key => $value) {
         unset($to);
         unset($cc);
         unset($bcc);
         $to[] = ENVIRONMENT == LOCAL || ENVIRONMENT == BETA ? $_SERVER['REMOTE_USER'] : MAIL_OGI;
         $cc[] = ENVIRONMENT == LOCAL || ENVIRONMENT == BETA ? $_SERVER['REMOTE_USER'] : MAIL_MEX;
         $dolly_users = explode(',', $param->{$key}->dolly_users);
         foreach ($dolly_users as $key2 => $value2) {
             if (array_search($value2, $dolly_users)) {
                 if ($value2 == $param->{$key}->requested_by) {
                     unset($dolly_users[$key2]);
                 } else {
                     $cc[] = $value2;
                 }
             }
         }
         $product = Product::load($param->{$key}->product_id)->to_array();
         $product_name = $product['name'];
         $tpl = $param->{$key};
         $tpl->server_type = $key;
         $tpl->comments = $param->{$key}->comments_ogi;
         $tpl->dolly_users = $param->{$key}->dolly_users;
         //Get email template
         ob_start();
         $subject = '[TUNA][chklst] ' . $param->{$key}->environment . ' ' . $key . ' checklist for ' . $product_name;
         include 'mail_templates/new_gameserver_checklist.php';
         $body = ob_get_contents();
         ob_end_clean();
         $m = new Mail('text/plain');
         $m->from($_SERVER['REMOTE_USER']);
         $m->to(@implode(',', $to));
         $m->cc(@implode(',', $cc));
         $m->bcc(@implode(',', $bcc));
         $m->subject($subject);
         $m->body($body);
         $m->send();
     }
     TunaLog::info_log(__CLASS__, __FUNCTION__, $_SERVER['REMOTE_USER'], '');
 }
开发者ID:xpeknw,项目名称:vc,代码行数:45,代码来源:Mail.class.php

示例11: header

 }
 if ($pass == $pass1) {
     $pass = md5($pass);
     //зашифрованный пароль можно использ функцию зашифровки в default myHash
 } else {
     $_SESSION['info'] = 'Пароль не правельный';
     header("Location: ../passback.php");
     exit;
 }
 if (!isset($_SESSION['info'])) {
     $res = mysqli_query($connect, "SELECT email FROM capons\n                              WHERE email = '{$email}'\n                              ") or die(mysqli_error());
     $row = mysqli_fetch_assoc($res);
     if (isset($row['email'])) {
         mysqli_query($connect, "UPDATE capons SET\n                              pass = '{$pass}'\n                              WHERE email = '" . $row['email'] . "'\n                              ") or die(mysqli_error());
         // $id = mysqli_insert_id($connect); //функция возвращает ID последнего добавленного элемента в БД - что-бы передать ID для проверки активации
         Mail::$to = $email;
         //класс Mail вызываеться из папка class Mail  - функцией в файле default
         Mail::$subject = 'Ваш новый пароль для bogdandvinin.zzz.com.ua';
         Mail::$text = 'Вам новый:  ' . $pass1;
         //передем ID полученый из нашего добавленного пользавателя и отправляем через GET для проверки
         Mail::send();
         header("Location: ../passback.php");
         exit;
         // проверка отпраки почты ниже
     } else {
         $_SESSION['info'] = 'вы ввели неправельный email';
         header("Location: ../passback.php");
     }
 }
 /*if(isset()){
       mysqli_query($connect, "UPDATE capons SET
开发者ID:capons,项目名称:WEB-ALL-Information,代码行数:31,代码来源:passback1.php

示例12: tryToSendTheMailOrThrowARuntimeException

 /**
  * @param Mail $mail
  * @throws RuntimeException
  */
 public function tryToSendTheMailOrThrowARuntimeException(Mail $mail)
 {
     $couldNotSent = !mail($mail->to(), $mail->subject(), $mail->content(), 'From: ' . $mail->from());
     if ($couldNotSent) {
         throw new RuntimeException('could not sent the mail' . PHP_EOL . 'values: ' . var_export($mail, true));
     }
 }
开发者ID:stevleibelt,项目名称:refactoring,代码行数:11,代码来源:04_refactored.php

示例13: header

    }
    if ($pass == $pass1) {
        $pass = md5($pass);
        //зашифрованный пароль можно использ функцию зашифровки в default myHash
    } else {
        $_SESSION['info'] = 'Пароли не совпадают';
        header("Location: ../Sett.php");
        exit;
    }
    if ($_SESSION['user']['pass'] == $pass) {
        $_SESSION['info'] = 'пароль похож на старый';
        header("Location: ../Sett.php");
        exit;
    }
    if ($email == $_SESSION['user']['email']) {
        mysqli_query($connect, "UPDATE capons SET\n                              pass = '{$pass}'\n                              WHERE id = '{$coil}'\n                              ") or die(mysqli_error());
        // $id = mysqli_insert_id($connect); //функция возвращает ID последнего добавленного элемента в БД - что-бы передать ID для проверки активации
        Mail::$to = $_SESSION['user']['email'];
        //класс Mail вызываеться из папка class Mail  - функцией в файле default
        Mail::$subject = 'Ваш новый пароль на http://bogdandvinin.zzz.com.ua';
        Mail::$text = 'Ваш новый пароль: ' . $pass1;
        //передем ID полученый из нашего добавленного пользавателя и отправляем через GET для проверки
        Mail::send();
        header("Location: ../Sett.php");
        exit;
        // проверка отпраки почты ниже
    } else {
        $_SESSION['info'] = 'вы ввели неправельный email';
        header("Location: ../Sett.php");
    }
}
开发者ID:capons,项目名称:WEB-ALL-Information,代码行数:31,代码来源:changepass.php

示例14: edit

 /**
  * Create or edit an user
  */
 public function edit()
 {
     $user = App::session()->getUser();
     $roles = array_map(function ($role) {
         return $role->getLabel();
     }, Role::getAll('id'));
     $param = array('id' => 'user-profile-form', 'upload' => true, 'object' => $user, 'fieldsets' => array('general' => array('legend' => Lang::get('admin.user-form-general-legend'), new TextInput(array('name' => 'username', 'required' => true, 'label' => Lang::get('admin.user-form-username-label'), 'disabled' => true)), new EmailInput(array('name' => 'email', 'required' => true, 'label' => Lang::get('admin.user-form-email-label')))), 'profile' => array('legend' => Lang::get('admin.user-form-profile-legend')), '_submits' => array(new SubmitInput(array('name' => 'valid', 'value' => Lang::get($this->_plugin . '.valid-button'))))), 'onsuccess' => 'app.dialog("close")');
     // Get the user profile questions
     $questions = ProfileQuestion::getAll('name', array(), array('order' => DB::SORT_ASC));
     // Generate the question fields
     foreach ($questions as $question) {
         if ($question->displayInProfile && $question->isAllowedForRole($user->roleId)) {
             $classname = '\\Hawk\\' . ucwords($question->type) . 'Input';
             $field = json_decode($question->parameters, true);
             $field['name'] = $question->name;
             $field['id'] = 'user-form-' . $question->name . '-input';
             $field['independant'] = true;
             $field['label'] = Lang::get('admin.profile-question-' . $question->name . '-label');
             if (isset($field['readonly'])) {
                 if ($field['readonly']) {
                     $field['required'] = false;
                 }
             }
             if ($user) {
                 if ($question->type == "file") {
                     $field['after'] = sprintf('<img src="%s" class="profile-image" />', $user->getProfileData($question->name) ? $user->getProfileData($question->name) : '');
                 } else {
                     $field['default'] = $user->getProfileData($question->name);
                 }
             }
             if ($question->name == 'language') {
                 // Get language options
                 $languages = Language::getAllActive();
                 $options = array();
                 foreach ($languages as $language) {
                     $options[$language->tag] = $language->label;
                 }
                 $field['options'] = $options;
                 if (!$field['default']) {
                     $field['default'] = Option::get($this->_plugin . '.language');
                 }
             }
             $param['fieldsets']['profile'][] = new $classname($field);
         }
     }
     $form = new Form($param);
     if (!$form->submitted()) {
         return NoSidebarTab::make(array('title' => Lang::get('admin.user-form-title'), 'page' => array('content' => $form)));
     } else {
         try {
             foreach ($questions as $question) {
                 if ($question->displayInProfile && $question->isAllowedForRole($user->roleId)) {
                     if ($question->type === 'file') {
                         $upload = Upload::getInstance($question->name);
                         if ($upload) {
                             $file = $upload->getFile(0);
                             $dir = Plugin::current()->getPublicUserfilesDir() . 'img/';
                             $url = Plugin::current()->getUserfilesUrl() . 'img/';
                             if (!is_dir($dir)) {
                                 mkdir($dir, 0755, true);
                             }
                             $basename = uniqid() . $file->extension;
                             $upload->move($file, $dir, $basename);
                             $user->setProfileData($question->name, $url . $basename);
                         }
                     } else {
                         $user->setProfileData($question->name, $form->inputs[$question->name]->dbvalue());
                     }
                 }
             }
             $user->saveProfile();
             if ($form->getData('email') !== $user->email) {
                 // The user asked to reset it email
                 // Check this email is not used by another user on the application
                 $existingUser = User::getByExample(new DBExample(array('id' => array('$ne' => $user->id), 'email' => $form->getData('email'))));
                 if ($existingUser) {
                     return $form->response(Form::STATUS_CHECK_ERROR, Lang::get($this->_plugin . '.reset-email-already-used'));
                 }
                 // Send the email to validate the new email
                 // Create the token to validate the new email
                 $tokenData = array('userId' => $user->id, 'currentEmail' => $user->email, 'newEmail' => $form->getData('email'), 'createTime' => time());
                 $token = base64_encode(Crypto::aes256Encode(json_encode($tokenData)));
                 // Create the email content
                 $emailContent = View::make($this->getPlugin()->getView('change-email-validation.tpl'), array('sitename' => Option::get($this->_plugin . '.sitename'), 'validationUrl' => App::router()->getUrl('validate-new-email', array('token' => $token))));
                 $email = new Mail();
                 $email->to($form->getData('email'))->from(Option::get('main.mailer-from'), Option::get('main.mailer-from-name'))->title(Lang::get($this->_plugin . '.reset-email-title', array('sitename' => Option::get($this->_plugin . '.sitename'))))->content($emailContent)->subject(Lang::get($this->_plugin . '.reset-email-title', array('sitename' => Option::get($this->_plugin . '.sitename'))))->send();
                 return $form->response(Form::STATUS_SUCCESS, Lang::get($this->_plugin . '.user-profile-update-success-with-email'));
             }
             return $form->response(Form::STATUS_SUCCESS, Lang::get($this->_plugin . '.user-profile-update-success'));
         } catch (Exception $e) {
             return $form->response(Form::STATUS_ERROR, Lang::get($this->_plugin . '.user-profile-update-error'));
         }
     }
 }
开发者ID:elvyrra,项目名称:hawk,代码行数:97,代码来源:UserProfileController.php


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