send mail in Bids

parent cd90b11a
......@@ -4,6 +4,8 @@ namespace common\modules\bids\models;
use Yii;
use \common\models\Settings;
/**
* This is the model class for table "bids".
*
......@@ -99,6 +101,20 @@ class Bid extends \common\components\ActiveRecordModel
public function send()
{
$email = Settings::getValue('bids-support-email');
$message = Yii::$app->controller->view->render('@common/modules/bids/views/bid/mail-all', [
'model' => $this
]);
$headers = "MIME-Version: 1.0\r\n".
"Content-Transfer-Encoding: 8bit\r\n".
"Content-Type: text/html; charset=\"UTF-8\"\r\n".
"X-Mailer: PHP v.".phpversion()."\r\n".
"From: Заявка с сайта TaskOn <robot@task-on.com>\r\n";
$subject = "Заявка с сайта TaskOn";
mail($email, $subject, $message, $headers);
}
}
<?php
use yii\helpers\Html;
use common\modules\bids\models\Bid;
?>
Имя: <?=$model->name?><br>
Телефон: <?=$model->phone?><br>
Email: <?=$model->email?><br>
Сообщение: <?=$model->text?><br>
Файл: <?=($model->filename?Html::a($model->filename,\Yii::$app->params['frontUrl'].Bid::FILE_FOLDER.$model->filename):'')?><br>
Дата добавления заявки: <?=date('d.m.Y H:i:s', $model->created_at)?><br>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment