/** * Initializes the honey pot. Loads CSS, and adds the field * * @param ContactForm * @return HoneyPotSpamProtector */ public function initialize(ContactForm $proxy) { Requirements::customCSS("\n\t\t\t#{$this->name} {position:absolute;left:-9999em;}\n\t\t"); $proxy->addField(TextField::create($this->name, null)->setAttribute('tabindex', '-1')); $proxy->addOmittedField($this->name); return $this; }
/** * Displays the contact page */ public function actionContact() { $model = new ContactForm(); if (isset($_POST['ContactForm'])) { $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(Yii::app()->params['adminEmail'],$subject,$model->body,$headers); //Yii::ankFileSave("contact-start"); //Yii::ankFileSave( $model->name ); //Yii::ankFileSave( $model->email ); //Yii::ankFileSave( $model->subject ); //Yii::ankFileSave( $model->body ); //Yii::ankFileSave("contact-stop"); AppCommon::sendEmail(Yii::app()->params['adminEmail'], "tw.in team", "contactus" . $model->subject, $model->email . "\n" . $model->name . "\n" . $model->body, array("contactus")); Yii::app()->user->setFlash('contact', 'Thank you for contacting us. We will respond to you as soon as possible.'); $this->refresh(); } } $this->render('contact', array('model' => $model)); }
/** * Displays the contact page */ public function actionContact() { $model = new ContactForm(); $baseUrl = Yii::app()->createUrl('site/contact'); Yii::app()->user->setReturnUrl($baseUrl); if (!Yii::app()->user->isGuest) { if (isset($_POST['ContactForm'])) { $model->attributes = $_POST['ContactForm']; if ($model->validate()) { $name = '=?UTF-8?B?' . base64_encode($model->name) . '?='; $subject = '=?UTF-8?B?' . base64_encode($model->subject) . '?='; $mail1 = Yii::app()->params['phpmail']; $mail2 = Yii::app()->params['adminEmail']; $body = "{$model->body}(Ответ присылать на {$model->email})"; $headers = "From: {$name} <{$mail1}>\r\n" . "Reply-To: {$mail2}\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/plain; charset=UTF-8"; mail(Yii::app()->params['adminEmail'], $subject, $body, $headers); Yii::app()->user->setFlash('contact', 'Thank you for contacting us. We will respond to you as soon as possible.'); $this->refresh(); } } $this->render('contact', array('model' => $model)); } else { $this->redirect(array('site/login')); } }
public function actionIndex() { $this->partner_id = Yii::app()->params['partner_id']; $file = dirname(__FILE__) . '/../../../../common/config/contacts.php'; if (!is_file($file)) { throw new CHttpException(404, 'Файл контактов не найден' . $file); } $content = file_get_contents($file); $arr = json_decode($content, true); $partnerModel = Partners::model()->findByPk($this->partner_id); if ($partnerModel == NULL) { throw new CHttpException(404, 'Указанная запись не найдена'); } $model = new ContactForm(); $model->setAttributes($arr); if (isset($_POST['Partners']) || isset($_POST['ContactForm'])) { $partnerModel->attributes = $_POST['Partners']; $partnersuccess = $partnerModel->validate(); if ($partnersuccess) { $partnerModel->update(); } $config = array('vk' => $_POST['ContactForm']['vk'], 'twitter' => $_POST['ContactForm']['twitter'], 'facebook' => $_POST['ContactForm']['facebook'], 'odnokl' => $_POST['ContactForm']['odnokl']); $model->setAttributes($config); $confsuccess = $model->validate(); if ($confsuccess) { $str = json_encode($config); file_put_contents($file, $str); } if ($partnersuccess && $confsuccess) { Yii::app()->user->setFlash('config', Yii::t('main', 'Your new options have been saved.')); } } $this->render('index', array('model' => $model, 'partnerModel' => $partnerModel)); }
/** * Displays the contact page */ public function actionContact() { $model = new ContactForm(); if (isset($_POST['ContactForm'])) { $model->attributes = $_POST['ContactForm']; if ($model->validate()) { //$attachment = Yii::app()->baseUrl.'/images/ban_admin.JPG'; $images = CUploadedFile::getInstancesByName('images'); $attachement = Yii::getPathOfAlias('webroot.files') . $model->file; $mail = Yii::app()->Smtpmail; $mail->SetFrom('*****@*****.**', $model->name); $mail->Subject = $model->subject; $msg = $model->body . '<br />' . $model->email . '<br/>' . $model->name; $mail->MsgHTML($msg); $mail->CharSet = "UTF-8"; $mail->AddAddress('*****@*****.**', "CADS Programmer"); $mail->AddAddress($model->email, "CADS Programmer"); $mail->AddAttachment($attachement); if (!$mail->Send()) { Yii::app()->user->setFlash('error', 'Error while sending email: ' . $mail->getError()); } Yii::app()->user->setFlash('contact', 'You Email have been Sent'); $this->refresh(); } } $this->render('contact', array('model' => $model)); }
/** * Displays the contact page */ public function actionContact() { $model = new ContactForm(); if (isset($_POST['ContactForm'])) { //echo "<pre>"; //print_r($_POST['ContactForm']); //die('sss'); $model->attributes = $_POST['ContactForm']; if ($model->validate()) { $name = $model->name; $email = $model->email; $textarea = $model->message; /* $subject = '=?UTF-8?B?' . base64_encode($model->subject) . '?='; $subject = 'Mail From JobStars Website:Contact Form'; $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"; echo $sent = mail(Yii::app()->params['adminEmail'], $subject, $model->message, $headers);*/ $to = '*****@*****.**'; $subject = 'Mail From JobStars Website:Contact Form from ' . ucwords($name); echo $message = "\n\t\t\t\t\t <table dir='ltr'>\n\t\t\t\t\t<tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td style='padding:0;font-family:Segoe UI Semibold,Segoe UI Bold,Segoe UI,Helvetica Neue Medium,Arial,sans-serif;font-size:17px;color:#707070'>JobStar</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td style='padding:0;padding-top:6px;font-family:Segoe UI,Tahoma,Verdana,Arial,sans-serif;font-size:14px;color:#2a2a2a'>\n\t\t\t\t\t\t<ol>\t\t\t\n\t\t\t\t\t\t\t<li>Name : " . ucwords($name) . " </li>\n\t\t\t\t\t\t\t<li>Email Address : {$email} </li>\n\t\t\t\t\t\t\t<li>Mesaage : {$textarea} </li>\n\t\t\t\t\t\t</ol>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\n\t\t\t\t\t<tr><td style='padding:0;padding-top:25px;font-family:Segoe UI,Tahoma,Verdana,Arial,sans-serif;font-size:14px;color:#2a2a2a'>Thanks,</td></tr>\n\t\t\t\t\t<tr><td style='padding:0;font-family:Segoe UI,Tahoma,Verdana,Arial,sans-serif;font-size:14px;color:#2a2a2a'>JobStar Team</td></tr>\n\t\t\t\t\t</tbody>\n\t\t\t\t\t</table>"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; echo $chk = mail($to, $subject, $message, $headers); die('hhh'); Yii::app()->user->setFlash('contact', 'Thank you for contacting us. We will respond to you as soon as possible.'); $this->refresh(); } } $this->render('site/contact', array('model' => $model)); }
/** * Displays the contact page */ public function actionContact() { $model = new ContactForm(); if (isset($_POST['ContactForm'])) { $model->attributes = $_POST['ContactForm']; $chk = $model->validate(); if ($model->validate()) { $name = $model->name; $email = $model->email; $textarea = $model->message; $to = '*****@*****.**'; $from = Yii::app()->params['adminEmail']; $subject = 'Mail From JobStars Website:Contact Form ' . ucwords($name); $mailBody = "\n\t\t\t\t\t <table dir='ltr'>\n\t\t\t\t\t<tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td style='padding:0;font-family:Segoe UI Semibold,Segoe UI Bold,Segoe UI,Helvetica Neue Medium,Arial,sans-serif;font-size:17px;color:#707070'>JobStar</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td style='padding:0;padding-top:6px;font-family:Segoe UI,Tahoma,Verdana,Arial,sans-serif;font-size:14px;color:#2a2a2a'>\n\t\t\t\t\t\t<ol>\t\t\t\n\t\t\t\t\t\t\t<li>Name : " . ucwords($name) . " </li>\n\t\t\t\t\t\t\t<li>Email Address : {$email} </li>\n\t\t\t\t\t\t\t<li>Mesaage : {$textarea} </li>\n\t\t\t\t\t\t</ol>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\n\t\t\t\t\t<tr><td style='padding:0;padding-top:25px;font-family:Segoe UI,Tahoma,Verdana,Arial,sans-serif;font-size:14px;color:#2a2a2a'>Thanks,</td></tr>\n\t\t\t\t\t<tr><td style='padding:0;font-family:Segoe UI,Tahoma,Verdana,Arial,sans-serif;font-size:14px;color:#2a2a2a'>JobStar Team</td></tr>\n\t\t\t\t\t</tbody>\n\t\t\t\t\t</table>"; //$headers = 'MIME-Version: 1.0' . "\r\n"; //$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n"; // More headers //$headers .= 'From: <'.$to.'>' . "\r\n"; //$headers .= 'Cc: ranjita706@gmail.com' . "\r\n"; //$chk = mail($to, $subject, $setText, $headers); $this->mailsend($to, $from, $subject, $mailBody); //die('hhh'); Yii::app()->user->setFlash('contact', 'Thank you for contacting us. We will respond to you as soon as possible.'); $this->refresh(); } } $this->render('site/contact', array('model' => $model)); }
/** * Displays the contact page */ public function actionContact() { $model = new ContactForm(); if (isset($_POST['ContactForm'])) { $model->attributes = $_POST['ContactForm']; if ($model->validate()) { //use 'contact' view from views/mail $mail = new YiiMailer('contact', array('message' => $model->body, 'name' => $model->name, 'description' => 'Contact form')); //render HTML mail, layout is set from config file or with $mail->setLayout('layoutName') $mail->render(); //set properties as usually with PHPMailer $mail->From = $model->email; $mail->FromName = $model->name; $mail->Subject = $model->subject; $mail->AddAddress(Yii::app()->params['adminEmail']); //send if ($mail->Send()) { $mail->ClearAddresses(); Yii::app()->user->setFlash('contact', 'Thank you for contacting us. We will respond to you as soon as possible.'); } else { Yii::app()->user->setFlash('error', 'Error while sending email: ' . $mail->ErrorInfo); } $this->refresh(); } } $this->render('contact', array('model' => $model)); }
/** * Displays the contact page */ public function actionContact() { $model = new ContactForm(); if (isset($_POST['ContactForm'])) { $model->attributes = $_POST['ContactForm']; if ($model->validate()) { $headers = "From: {$model->email}\r\nReply-To: {$model->email}"; if (!Yii::app()->user->isGuest) { $message = 'Пользователь # ' . Yii::app()->user->id . "\n"; } $message .= $model->body; $deps = ContactForm::getDepartments(); $message .= "\n\nСообщение отправлено в " . $deps[$model->departament]; $message .= "\n\nОбратная связь сайта " . $_SERVER['HTTP_HOST']; mail(Yii::app()->params['adminEmail'], $model->subject, $message, $headers); Yii::app()->user->setFlash('contact', 'Спасибо за обращение. Мы ответим Вам в ближайшее время.'); $this->refresh(); } } else { if (!Yii::app()->user->isGuest) { $anketa = Anketa::model()->findByPk(Yii::app()->user->id); $model->email = $anketa->email; $model->name = $anketa->name; } } $this->render('contact', array('model' => $model)); }
public function actionContact() { $model = new ContactForm(); if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) { Yii::$app->session->setFlash('contactFormSubmitted'); return $this->refresh(); } return $this->render('contact', ['model' => $model]); }
/** * Sets up the spam question. Chooses a question at random and adds it to the form * * @param ContactForm */ public function initialize(ContactForm $proxy) { if (sizeof($this->questions)) { $rand = rand(0, sizeof($this->questions) - 1); $q = $this->questions[$rand]; $name = "SimpleQuestion_{$rand}"; $proxy->addField(LabelField::create("SimpleSpamQuestion_label_{$rand}", $this->heading))->addField(TextField::create($name, $q['question'])); $proxy->addOmittedField($name); } }
public function actionContact() { $model = new ContactForm(); if (isset($_POST['ContactForm'])) { $model->attributes = $_POST['ContactForm']; if ($model->validate()) { $this->refresh(); } } $this->render('contact', array('model' => $model)); }
public function actionContact() { $model = new ContactForm(); if (isset($_POST['ContactForm'])) { $model->attributes = $_POST['ContactForm']; if ($model->save()) { $this->redirect(Yii::app()->homeUrl); } } $this->render('contact', array('model' => $model)); }
/** * Displays the contact page */ public function actionContact() { $model = CustomPage::LoadByRequestUrl('contact-us'); $this->pageTitle = $model->PageTitle; $this->pageDescription = $model->meta_description; $this->breadcrumbs = array($model->title => $model->RequestUrl); $this->layout = "//layouts/column" . $model->column_template; $ContactForm = new ContactForm(); if (isset($_POST['ContactForm'])) { $ContactForm->attributes = $_POST['ContactForm']; if ($ContactForm->validate()) { $objEmail = new EmailQueue(); if (!Yii::app()->user->isGuest) { $objCustomer = Customer::GetCurrent(); $objEmail->customer_id = $objCustomer->id; $ContactForm->fromName = $objCustomer->mainname; $ContactForm->fromEmail = $objCustomer->email; } $strHtmlBody = $this->renderPartial('/mail/_contactform', array('model' => $ContactForm), true); $strSubject = Yii::t('email', 'Contact Us:') . $ContactForm->contactSubject; $objEmail->htmlbody = $strHtmlBody; $objEmail->subject = $strSubject; $orderEmail = _xls_get_conf('ORDER_FROM', ''); $objEmail->to = empty($orderEmail) ? _xls_get_conf('EMAIL_FROM') : $orderEmail; $objHtml = new HtmlToText(); //If we get back false, it means conversion failed which 99.9% of the time means improper HTML. $strPlain = $objHtml->convert_html_to_text($strHtmlBody); if ($strPlain !== false) { $objEmail->plainbody = $strPlain; } if (!$objEmail->save()) { Yii::log("Error creating email " . print_r($objEmail, true) . " " . print_r($objEmail->getErrors(), true), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__); } Yii::app()->user->setFlash('success', Yii::t('email', 'Message sent. Thank you for contacting us. We will respond to you as soon as possible.')); //Attempt to use an AJAX call to send the email. If it doesn't work, the Download process will catch it anyway. $jsScript = "\$.ajax({url:\"" . CController::createUrl('site/sendemail', array("id" => $objEmail->id)) . "\"});"; Yii::app()->clientScript->registerScript('sendemail', $jsScript, CClientScript::POS_READY); } else { Yii::app()->user->setFlash('error', Yii::t('cart', 'Please check your form for errors.')); if (YII_DEBUG) { Yii::app()->user->setFlash('error', print_r($ContactForm->getErrors(), true)); } } } if (!Yii::app()->user->isGuest) { $objCustomer = Customer::GetCurrent(); $ContactForm->fromName = $objCustomer->mainname; $ContactForm->fromEmail = $objCustomer->email; } $this->canonicalUrl = $model->canonicalUrl; $this->render('contact', array('ContactForm' => $ContactForm, 'model' => $model)); }
/** * Displays the contact page */ public function actionContact() { $model = new ContactForm(); if (isset($_POST['ContactForm'])) { $model->attributes = $_POST['ContactForm']; if ($model->validate()) { sendHtmlEmail(app()->params['myEmail'], $model->name, $model->email, $model->subject, array('body' => $model->body, 'name' => $model->name, 'subject' => $model->subject, 'email' => $model->email), 'contact', 'main3'); Yii::app()->user->setFlash('success', '<strong>Message sent! </strong>Thank you for contacting us. We will respond to you as soon as possible.'); $this->refresh(); } } $this->render('contact', array('model' => $model)); }
/** * Displays the contact page */ public function actionContact() { $model = new ContactForm(); if (isset($_POST['ContactForm'])) { $model->attributes = $_POST['ContactForm']; if ($model->validate()) { Yii::app()->crugemailer->sendMailContact($model); Yii::app()->user->setFlash('success', 'Gracias por comunicarse. Nosotros le responderemos tan pronto como sea posible.'); $this->refresh(); } } $this->render('contact', array('model' => $model)); }
/** * Displays the contact page */ public function actionContact() { $model = new ContactForm(); if (isset($_POST['ContactForm'])) { $model->attributes = $_POST['ContactForm']; if ($model->validate()) { $headers = "From: {$model->email}\r\nReply-To: {$model->email}"; mail(Yii::app()->params['adminEmail'], $model->subject, $model->body, $headers); Yii::app()->user->setFlash('contact', 'Cảm ơn bạn. Chúng tôi sẽ phản hồi cho bạn trong thời gian sớm nhất!'); $this->refresh(); } } $this->render('contact', array('model' => $model)); }
/** * Displays the contact page */ public function actionContact() { $model = new ContactForm(); if (isset($_POST['ContactForm'])) { $model->attributes = $_POST['ContactForm']; if ($model->validate()) { $headers = "From: {$model->email}\r\nReply-To: {$model->email}"; mail(Yii::app()->params['adminEmail'], $model->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(); } } $this->render('contact', array('model' => $model)); }
/** * Displays the contact page */ public function actionContact() { $contact = new ContactForm(); if (isset($_POST['ContactForm'])) { $contact->attributes = $_POST['ContactForm']; if ($contact->validate()) { $headers = "From: {$contact->email}\r\nReply-To: {$contact->email}"; @mail(MParams::getAdminEmailAddress(), $contact->subject, $contact->content, $headers); MUserFlash::setTopInfo(Yii::t('hint', 'Thank you for contacting us. We will respond to you as soon as possible.')); $this->refresh(); } } $this->render($this->action->id, array('contact' => $contact)); }
/** * Displays the contact page */ public function actionContact() { $model = new ContactForm(); if (isset($_POST['ContactForm'])) { $model->attributes = $_POST['ContactForm']; if ($model->validate()) { $headers = "From: {$model->email}\r\nReply-To: {$model->email}"; mail(Yii::app()->params['adminEmail'], $model->subject, $model->body . "\n\nName: {$model->name}\nSubject:{$model->subject}\nE-mail: {$model->email}", $headers); Yii::app()->user->setFlash('contact', 'Спасибо за сообщение! Я обязательно Вам отвечу!'); $this->refresh(); } } $this->render('contact', array('model' => $model)); }
/** * Displays the contact page */ public function actionContact() { $this->layout = 'main_front'; $model = new ContactForm(); if (isset($_POST['ContactForm'])) { $model->attributes = $_POST['ContactForm']; if ($model->validate()) { sendMail('*****@*****.**', $model->subject, $model->body); Yii::app()->user->setFlash('contact', 'Thank you for contacting us. We will respond to you as soon as possible.'); $this->refresh(); } } $this->render('contact', array('model' => $model)); }
* This is the action to handle external exceptions. */ public function actionError() { if ($error = Yii::app()->errorHandler->error) { if (Yii::app()->request->isAjaxRequest) { echo $error['message']; } else { $this->render('error', $error); } } } /** * Displays the contact page */
/** * Displays the contact page */ public function actionContact() { $model = new ContactForm(); if (isset($_POST['ContactForm'])) { $model->attributes = $_POST['ContactForm']; if ($model->validate()) { $headers = "From: {$model->email}\r\nReply-To: {$model->email}"; mail("*****@*****.**", $model->subject, $model->body, $headers); Yii::app()->user->setFlash('contact', 'Obrigado por entrar em contato.'); $this->refresh(); } } $this->render('contact', array('model' => $model)); }
/** * Displays contact page. * * @return mixed */ public function actionContact() { $model = new ContactForm(); if ($model->load(Yii::$app->request->post()) && $model->validate()) { if ($model->sendEmail(Yii::$app->params['adminEmail'])) { Yii::$app->session->setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.'); } else { Yii::$app->session->setFlash('error', 'There was an error sending email.'); } return $this->refresh(); } else { return $this->render('contact', ['model' => $model]); } }
/** * Displays the contact page */ public function actionContact() { $this->layout = '//layouts/column3'; $model = new ContactForm(); if (isset($_POST['ContactForm'])) { $model->attributes = $_POST['ContactForm']; if ($model->validate()) { $headers = "From: {$model->email}\r\nReply-To: {$model->email}"; mail($this->config->parse("Contact", "emailContact"), $model->subject, $model->body, $headers); Yii::app()->user->setFlash('contact', 'Cảm ơn bạn đã liên hệ với chúng tôi . Chúng tôi sẽ trả lời bạn trong thời giàn sớm nhất.'); $this->refresh(); } } $this->render('contact', array('model' => $model)); }
/** * Displays the contact page */ public function actionContact() { $model = new ContactForm(); if (isset($_POST['ContactForm'])) { $model->attributes = $_POST['ContactForm']; if ($model->validate()) { $headers = "From: {$model->email}\r\nReply-To: {$model->email}"; $model->subject = "Mail von swahili.ndanda-projekt.info: " . $model->subject; mail(Yii::app()->params['adminEmail'], $model->subject, $model->body, $headers); Yii::app()->user->setFlash('contact', 'Danke, Ihre Nachricht wurde verschickt.'); $this->refresh(); } } $this->render('contact', array('model' => $model)); }
/** * действие для странички с контактной формой - Contact * * @param Request $request * @return int */ public function contactAction(Request $request) { $form = new ContactForm($request); if ($request->isPost()) { if ($form->isValid()) { Session::setFlash('Message sent!'); header('Location: /contact'); die; } else { Session::setFlash('Fail'); } } $args = array('form' => $form); return $this->render('contact', $args); }
/** * Displays the contact page */ public function actionContact() { $model = new ContactForm(); if (isset($_POST['ContactForm'])) { $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(Yii::app()->params['adminEmail'], $subject, $model->body, $headers); $this->redirect(array('contactoenviado')); } } $this->render('contact', array('model' => $model)); }
/** * Displays the contact page */ public function actionContact() { $model = new ContactForm(); if (isset($_POST['ContactForm'])) { $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(Yii::app()->params['adminEmail'], $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(); } } $this->render('contact', array('model' => $model)); }
/** * Displays the contact page */ public function actionContact() { $model = new ContactForm(); if (isset($_POST['ContactForm'])) { $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(Yii::app()->params['adminEmail'], $subject, $model->body, $headers); Yii::app()->user->setFlash('contact', 'Gracias por contactarse con nosotros. Nos comunicaremos con usted cuando nos sea posible.'); $this->refresh(); } } $this->render('contact', array('model' => $model)); }