本文整理汇总了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));
}
示例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);
}