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


PHP YiiMailMessage::setReplyTo方法代码示例

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


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

示例1: actionContact

 /**
  * Displays the contact page
  */
 public function actionContact()
 {
     $model = new ContactForm();
     if (isset($_POST['ContactForm'])) {
         // main contact form
         $model->attributes = $_POST['ContactForm'];
         if ($model->validate()) {
             $name = '=?UTF-8?B?' . base64_encode($model->name) . '?=';
             $subject = '=?UTF-8?B?' . base64_encode($model->subject) . '?=';
             $headers = "From: {$name} <{$model->email}>\r\n" . "Reply-To: {$model->email}\r\n" . "MIME-Version: 1.0\r\n" . "Content-type: text/plain; charset=UTF-8";
             mail('LinxCircle Contact <contact@linxcircle.com>', $subject, $model->body, $headers);
             Yii::app()->user->setFlash('contact', 'Thank you for contacting us. We will respond to you as soon as possible.');
             $this->refresh();
         }
     } else {
         if (isset($_POST['ContactableForm'])) {
             // jquery widget
             // Assign contact info
             $name = stripcslashes($_POST['name']);
             $emailAddr = stripcslashes($_POST['email']);
             $issue = stripcslashes($_POST['issue']);
             $comment = stripcslashes($_POST['message']);
             $subject = stripcslashes($_POST['subject']);
             //$name='=?UTF-8?B?'.base64_encode($name).'?=';
             $subject = '=?UTF-8?B?' . base64_encode($subject) . '?=';
             // Format message
             $contactMessage = "<div>\n\t\t\t<p><strong>Name:</strong> {$name} <br />\n\t\t\t<strong>E-mail:</strong> {$emailAddr} <br />\n\t\t\t<strong>Issue:</strong> {$issue} </p>\n\t\t\t\t\n\t\t\t<p><strong>Message:</strong> {$comment} </p>\n\t\t\t\t\n\t\t\t<p><strong>Sending IP:</strong> {$_SERVER['REMOTE_ADDR']}<br />\n\t\t\t<strong>Sent via:</strong> {$_SERVER['HTTP_HOST']}</p>\n\t\t\t</div>";
             // Send and check the message status
             $message = new YiiMailMessage();
             $message->setBody($contactMessage, 'text/html');
             $message->setSubject($subject);
             $message->setTo(array('contact@linxcircle.com' => 'LinxCircle Contact'));
             $message->setFrom(array($emailAddr => $name . " (LinxCircle)"));
             $message->setReplyTo(array($emailAddr => $name . " (LinxCircle)"));
             $result = Yii::app()->mail->send($message);
             $response = $result ? "success" : "failure";
             $output = json_encode(array("response" => $response, "result" => $result));
             header('content-type: application/json; charset=utf-8');
             echo $output;
             return;
         }
     }
     $this->render('contact', array('model' => $model));
 }
开发者ID:Lucerin,项目名称:Yii-projects,代码行数:47,代码来源:SiteController.php

示例2: SendMail

 public function SendMail($mail = array())
 {
     $mailer = new YiiMail();
     $mailer->transportType = 'smtp';
     $mailer->transportOptions = array('host' => Config::model()->getValueByKey('host_sendmail'), 'username' => Config::model()->getValueByKey('username_sendmail'), 'password' => Config::model()->getValueByKey('password_sendmail'), 'port' => Config::model()->getValueByKey('port_sendmail'), 'encryption' => Config::model()->getValueByKey('encryption_sendmail'));
     $message = new YiiMailMessage();
     $message->setFrom(array(Config::model()->getValueByKey('username_sendmail') => Config::model()->getValueByKey('displayname_sendmail')));
     $message->setTo(array($mail['mailto']));
     $message->setReplyTo(array($mail['replyto']));
     $message->setSubject($mail['subject']);
     $message->setBody($mail['body'], 'text/html');
     $mailer->send($message);
 }
开发者ID:phantsang,项目名称:xzsUuJg0keDWW5Rx679PHBVBJ,代码行数:13,代码来源:SiteController.php


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