本文整理汇总了PHP中YiiMailMessage::setSubject方法的典型用法代码示例。如果您正苦于以下问题:PHP YiiMailMessage::setSubject方法的具体用法?PHP YiiMailMessage::setSubject怎么用?PHP YiiMailMessage::setSubject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类YiiMailMessage
的用法示例。
在下文中一共展示了YiiMailMessage::setSubject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionReport
public function actionReport()
{
$model = new ReportForm();
if (isset($_POST['ReportForm'])) {
$model->attributes = $_POST['ReportForm'];
if ($model->validate()) {
if (!$model->email) {
$model->email = 'nobody@localhost';
}
if (!$model->name) {
$model->name = 'Anonymous';
}
$model->report = 'Sent through: ' . Yii::app()->request->getBaseUrl(true) . "\n\n" . $model->report;
$message = new YiiMailMessage();
$message->setTo(Yii::app()->params['admin_email']);
$message->setFrom(array($model->email => $model->name));
$message->setSubject(Yii::t('mc', 'Support Form'));
$message->setBody($model->report);
Yii::app()->mail->send($message);
Yii::app()->user->setFlash('report', Yii::t('mc', 'Thank you for contacting us!'));
Yii::log('Support form submitted');
$this->refresh();
}
}
$this->render('report', array('model' => $model));
}
示例2: actionCompleteRegistrationAjax
public function actionCompleteRegistrationAjax()
{
$client = new Client();
$client->attributes = $_POST['Client'];
if ($client->save()) {
$drive = new Drive();
$drive->attributes = $_POST['Drive'];
$drive->client_id = $client->primaryKey;
$drive->creation_date = date("Y-m-d H:i:s");
if ($drive->save()) {
$driv = Drive::model()->findByPk($drive->primaryKey);
$message = new YiiMailMessage();
$message->view = 'pruebamanejo';
$message->setBody(array("client" => $client, "drive" => $driv), 'text/html');
$message->setSubject('Solicitud Prueba de Manejo');
foreach ($driv->concessioner->emails as $email) {
// if($email->type=="DRIVE"){
if ($email->type == "QUOTATION") {
$message->addTo($email->description);
}
}
// $message->addTo("anaquishpe@ayasa.com.ec");
// $message->addTo("mgonzalez@ayasa.com.ec");
$message->addTo("gzumarraga@ayasa.com.ec");
$message->addTo("solicitudeswebnissan@gmail.com");
$message->setFrom(array(Yii::app()->params['adminEmail'] => 'El Equipo Nissan Ecuador'));
Yii::app()->mail->send($message);
echo json_encode(true);
} else {
echo json_encode(false);
}
}
}
示例3: actionSatisfaction
public function actionSatisfaction($id)
{
$suggestion = Suggestion::model()->findByPk($id);
$model = new SatisfactionS();
if (isset($_POST['SatisfactionS'])) {
$model->attributes = $_POST['SatisfactionS'];
$model->suggestion_id = $suggestion->id;
if ($model->save()) {
$sat = SatisfactionS::model()->findByPk($model->primaryKey);
$message = new YiiMailMessage();
$message->view = 'encuesta_s';
$message->setBody(array("satisfaction" => $sat), 'text/html');
$message->setSubject('Satisfacción del Prospecto Web.');
if ($sat->score < 10) {
$message->setSubject('Satisfacción del Prospecto Web.');
}
if ($sat->contact == "NO") {
$message->setSubject('Prospecto No Contactado');
}
$aux1 = strstr($suggestion->type, '-');
$aux = substr($aux1, 1, 1);
foreach ($suggestion->concessioner->emails as $email) {
if ($email->type == "SUGGESTION-{$aux}") {
$message->addTo($email->description);
// $message->addTo('franklin.paula@share.com.ec');
if ($email->type == "SUGGESTION-O") {
$message->addTo("rpazmino@ayasa.com.ec");
}
$message->setFrom(array(Yii::app()->params['adminEmail'] => 'El Equipo Nissan Ecuador'));
}
}
//$message->addTo("franklin.paula@share.com.ec");
$message->setFrom(array(Yii::app()->params['adminEmail'] => 'El Equipo Nissan Ecuador'));
Yii::app()->mail->send($message);
$this->render('satisfaction_finished', array('suggestion' => $suggestion));
}
} else {
if ($suggestion) {
$this->render('satisfaction', array('model' => $model, 'suggestion' => $suggestion));
}
}
}
示例4: sendEmail
public function sendEmail()
{
$this->checkEmailConditions();
Yii::import('application.extensions.yii-mail.YiiMailMessage');
$message = new YiiMailMessage();
$message->setSubject($this->emailSubject);
$message->view = $this->emailViewFile;
$message->setBody($this->emailParams, 'text/html');
$message->setTo($this->receiverEmail);
$message->from = $this->senderEmail;
return Yii::app()->mail->send($message);
}
示例5: sendSenderNotification
/**
* Send notification for user, that has sent message for administration
* @return mixed
*/
public function sendSenderNotification()
{
$this->checkNotificationCondition();
Yii::import('application.extensions.yii-mail.YiiMailMessage');
$senderNotification = new YiiMailMessage();
$senderNotification->setSubject($this->notificationSubject);
$senderNotification->view = $this->notificationViewFile;
$senderNotification->setBody($this->notificationParams, 'text/html');
$senderNotification->setTo($this->notificationReceiver);
$senderNotification->from = $this->notificationSender;
return Yii::app()->mail->send($senderNotification);
}
示例6: actionRubric
public function actionRubric($id = null)
{
if ($_POST['Form']) {
$model = new Form('new');
$this->performAjaxValidation($model);
$model->attributes = $_POST['Form'];
$model->date = time();
if ($_FILES['file']['tmp_name']) {
$file = CUploadedFile::getInstanceByName('file');
$model->file = $file->getName();
}
if ($model->save()) {
$text = 'Имя: ' . $model->name;
$text .= '<br />Фамилия: ' . $model->lastname;
$text .= '<br />E-mail: ' . $model->email;
$text .= '<br />Телефон: ' . $model->tel;
if ($model->arts) {
$text .= '<br />Артикулы под нанесение: ' . $model->arts;
}
if ($model->delivered) {
$text .= '<br />Желаемая дата заказа: ' . $model->delivered;
}
$text .= '<br />Кол-во цветов: ' . $model->color;
$text .= '<br />Тираж: ' . $model->tirazh;
$text .= '<br />Размеры: ' . $model->width . ' x ' . $model->height;
$text .= '<br />Драг.металы:';
$text .= '<br />Золото - ' . ($model->gold ? 'Да' : 'Нет');
$text .= '<br />Платина - ' . ($model->platina ? 'Да' : 'Нет');
if ($model->text) {
$text .= '<br />Примечание: ' . $model->text;
}
$message = new YiiMailMessage();
$message->setTo(array($this->getConfig('email3') => 'Комплекс Бар'));
$message->setFrom(array($model->email => $model->name . ' ' . $model->lastname));
$message->setSubject('Заказ на нанесение');
$message->setBody($text, 'text/html', 'utf8');
if ($_FILES['file']['tmp_name']) {
$fileNewPath = $_SERVER['DOCUMENT_ROOT'] . '/userdata/nanesenie/' . $file->getName();
$file->saveAs($fileNewPath);
$message->attach(Swift_Attachment::fromPath($fileNewPath));
}
Yii::app()->mail->send($message);
Yii::app()->user->setFlash('message', 'Спасибо за заказ. Наш менеджер свяжется с вами в ближайшее время.');
} else {
$this->render('rubric', $data);
}
$this->refresh();
}
$rubric = Rubrics::model()->findByPk($id);
$data = array('rubric' => $rubric);
$this->render('rubric', $data);
}
示例7: actionMailTes
public function actionMailTes()
{
$message = new YiiMailMessage();
$message->setBody('tes', 'text/html');
$message->setTo('neo_gazebo@yahoo.co.id');
$message->setSubject('tes');
$message->setFrom('admin@dcourier.com');
$html2pdf = Yii::app()->ePdf->HTML2PDF();
$html2pdf->WriteHTML('<p>hehehehe</p>');
$html2pdf->Output(dirname(Yii::app()->basePath) . '/pdf/tes.pdf', EYiiPdf::OUTPUT_TO_FILE);
$message->attach(Swift_Attachment::frompath(dirname(Yii::app()->basePath) . '/pdf/tes.pdf'));
Yii::app()->mail->send($message);
CVarDumper::dump(YiiMail::log($message), 10, true);
}
示例8: send
public static function send($to, $subject, $view, $params)
{
$message = new YiiMailMessage();
$message->view = $view;
$message->setSubject($subject);
$message->setBody($params, 'text/html');
$message->getHeaders()->addMailboxHeader('Sender');
$message->setSender(Yii::app()->mail->transportOptions['username']);
$message->addTo($to);
$message->from = Yii::app()->mail->transportOptions['username'];
try {
return Yii::app()->mail->send($message);
} catch (Exception $e) {
return false;
}
}
示例9: sendEmail
public function sendEmail()
{
$this->checkEmailConditions();
Yii::import('application.extensions.yii-mail.YiiMailMessage');
$message = new YiiMailMessage();
$message->setSubject($this->subject);
$message->view = 'mass-delivery';
$message->setBody(array('text' => $this->text), 'text/html');
$message->from = Yii::app()->params['emails']['defaultSender'];
if (is_array($this->receiverEmail)) {
foreach ($this->receiverEmail as $email) {
$message->setTo($email);
Yii::app()->mail->send($message);
}
}
return TRUE;
}
示例10: save
public function save()
{
/** @var $user User */
$user = User::model()->findByAttributes(array('email' => $this->email));
if ($user) {
$newPassword = substr(md5(rand(1, 100)), 0, 8);
$user->changePassword($newPassword);
$user->save();
Yii::import('application.extensions.yii-mail.YiiMailMessage');
$message = new YiiMailMessage();
$message->setSubject('Відновлення паролю на сайті РЕЗИДЕНТ');
$message->view = 'restore-password';
$message->setBody(array('name' => $user->getFirstName(), 'password' => $newPassword), 'text/html');
$message->setTo($this->email);
$message->from = Yii::app()->params['emails']['defaultSender'];
Yii::app()->mail->send($message);
}
}
示例11: recoverPassword
public function recoverPassword()
{
$u = User::model()->findByAttributes(array('username' => $this->username));
$newPassword = substr(md5(uniqid()), 0, 6);
$u->password = $newPassword;
$u->save();
$body = "Hello " . $u->first_name . ' ' . $u->last_name . ",\n\nYour login details are:\n\n";
$body .= "Username: " . $u->username . "\n";
$body .= "Password: " . $newPassword . "\n";
$body .= "\n\nPromocast Team";
$message = new YiiMailMessage();
$message->setTo(array($u->email => $u->first_name . ' ' . $u->last_name));
$message->setFrom(array('promocast1@gmail.com' => 'Promocast'));
$message->setSubject('Your password');
$message->setBody($body);
$numsent = Yii::app()->mail->send($message);
return true;
}
示例12: actionComment
public function actionComment()
{
if (!isset($_GET['id'])) {
throw new CHttpException(500, "Ломаешь?");
}
/**
* @var $model SupportTickets
*/
$model = SupportTickets::model()->findByPk($_GET['id']);
if (!$model) {
throw new CHttpException(404, "Не найдено");
}
if (Yii::app()->request->isPostRequest) {
if (isset($_POST['content']) && isset($_POST['toClose'])) {
if ($_POST['toClose'] == 1) {
$model->status = 2;
} else {
$model->status = 1;
}
$model->save();
$m2 = new SupportTicketsComments();
$m2->ticketId = $model->id;
$m2->userId = Yii::app()->user->id;
$m2->datePosted = time();
$m2->isAnswer = 1;
$m2->content = $_POST['content'];
$m2->save();
Yii::import('ext.yii-mail.*');
$message = new YiiMailMessage();
$message->view = 'supportNewReply';
$message->setSubject('Тикет #' . $model->id . " - Новый ответ");
$message->setBody(array('model' => $model), 'text/html');
$message->setTo($model->user->email);
$message->from = array(Yii::app()->params['adminEmail'] => 'Crystal Reality Games');
Yii::app()->mail->send($message);
$this->redirect($this->createUrl("index"));
} else {
$this->redirect($this->createUrl("view", ["id" => $model->id]));
}
}
}
示例13: mail
/**
*
* Generic Mail sender method send the generic perfony html mail
* @param array $params
* contains any param passed on to the generic view file
*
* basePath : absolute server path
* imgPath : absolute path to images folder
* subject : ovious
* email : message mail will be send to
* sectionTitle : message Section tilte
* title : message title
* genericText : information text at the top
* view : defaults to 'contact' but could be different
* body : is the main body of the message
* link : appended to the message for direct access to the subject
* placeholders : key/value array to use to find/replace in body
*
* @param string $view : name of the view to be used a base
*/
public static function mail($params)
{
$k_path_url = (isset($_SERVER['HTTPS']) and !empty($_SERVER['HTTPS']) and strtolower($_SERVER['HTTPS']) != 'off') ? 'https://' : 'http://';
$params['basePath'] = $k_path_url . $_SERVER['SERVER_NAME'] . substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], "/") + 1);
$params['imgPath'] = $params['basePath'] . 'images/email';
$yiimail = new YiiMailMessage();
if (!isset($params['subject'])) {
$params['subject'] = Yii::t('mail', 'subject' . $params['key']);
}
$yiimail->setSubject($params['subject']);
$yiimail->setTo(array($params['email']));
$yiimail->setFrom(array(Yii::app()->params['adminEmail']));
if (!isset($params['sectionTitle'])) {
$params['sectionTitle'] = Yii::t('mail', 'sectionTitle' . $params['key']);
}
if (!isset($params['title'])) {
$params['title'] = Yii::t('mail', 'title' . $params['key']);
}
if (!isset($params['genericText'])) {
$params['genericText'] = Yii::t('mail', 'genericText' . $params['key']);
}
$yiimail->view = isset($params['view']) ? $params['view'] : 'contact';
if (!isset($params['body'])) {
$params['body'] = Yii::t('mail', 'body' . $params['key']);
}
if (isset($params['link'])) {
$params['body'] .= "<br/><a href='" . Yii::app()->createAbsoluteUrl("/" . $params['link']) . "'>" . Yii::t(PTranslate::CAT_MAILS, 'Direct Link to access') . "</a>";
}
if (isset($params['placeholders'])) {
foreach ($params['placeholders'] as $key => $val) {
//throw new CHttpException('pouet avant : '.$params['placeholders'].' après : '.str_replace($key, $val, $params['placeholders']));
$params['body'] = str_replace($key, $val, $params['body']);
}
}
$yiimail->setBody($params, 'text/html');
if (Yii::app()->params['sendMails']) {
Yii::app()->mail->send($yiimail);
}
}
示例14: actionCreateAjax
public function actionCreateAjax($ccmp_id)
{
if (isset($_POST['User'])) {
//$this->performAjaxValidation($model4update, 'branch-form');
try {
$user = new User();
$user->username = $_POST['User']['username'];
$user->email = $_POST['User']['email'];
$user->superuser = 0;
$user->status = 1;
$profile = new Profile();
$profile->attributes = $_POST['Profile'];
if (!$user->validate() || !$profile->validate()) {
$this->renderPartial("/Customers/_form_horizontal_ajax", array('ccmp_id' => $ccmp_id, 'model4updateuser' => $user, 'model4updateprofile' => $profile));
exit;
}
$pass = CcmpCompany::createCustomerUser($user, $profile, $ccmp_id);
$yiiuser = Yii::app()->getComponent('user');
$yiiuser->setFlash('success', "Customer user created with password " . $pass);
if (isset($_POST['email_pass'])) {
$message = new YiiMailMessage();
$message->setSubject('New user created');
$message->setBody('New user created. <br />
username: <b>' . $user->username . '</b>, password:<b> ' . $pass . '</b>', 'text/html');
$message->addTo($_POST['email_pass']);
$message->from = 'noreply@parkoil.lt';
$sent = Yii::app()->mail->send($message);
}
} catch (Exception $e) {
$this->renderPartial("/Customers/_form_horizontal_ajax", array('ccmp_id' => $ccmp_id, 'model4updateuser' => $user, 'model4updateprofile' => $profile));
exit;
}
}
$model4newuser = new User();
$model4newprofile = new Profile();
$this->renderPartial("/Customers/_form_horizontal_ajax", array('ccmp_id' => $ccmp_id, 'model4updateuser' => $model4newuser, 'model4updateprofile' => $model4newprofile));
//$this->render('view', array('model' => $model, 'model4grid' => $model4grid, 'model4update' => $model4update));
}
示例15: registerUser
protected function registerUser()
{
$model = new User();
$model->first_name = $this->name;
$model->password = $this->password;
$model->email = $this->email;
$model->sex = $this->sex;
$model->role = WebUser::ROLE_USER;
if ($model->save(FALSE)) {
Yii::import('application.extensions.yii-mail.YiiMailMessage');
$message = new YiiMailMessage();
$message->setSubject('Вітаємо на сайті РЕЗИДЕНТ');
$message->view = 'registration-notification';
$message->setBody(array('name' => $this->name, 'password' => $this->password), 'text/html');
$message->setTo($this->email);
$message->from = Yii::app()->params['emails']['defaultSender'];
Yii::app()->mail->send($message);
$this->_userModel = $model;
return TRUE;
} else {
return FALSE;
}
}