|
|
|
@ -57,12 +57,17 @@ class FormController extends FrontendController
|
|
|
|
|
// save message |
|
|
|
|
$this->message_service->create($form->id, Json::encode($messageItems, JSON_UNESCAPED_UNICODE)); |
|
|
|
|
//prepare e-mail message |
|
|
|
|
$to = isset($form->return) && $form->return ? explode(',',$form->return) : [Yii::$app->params['adminEmail']]; |
|
|
|
|
$from = isset($form->from) && $form->from ? explode(',',$form->from) : [Yii::$app->params['adminEmail']]; |
|
|
|
|
$reply = isset($form->reply) && $form->reply ? explode(',',$form->reply) : $from; |
|
|
|
|
|
|
|
|
|
$sent = $this->mailer->compose( |
|
|
|
|
['html' => '@common/modules/forms/mail/form-html', 'text' => '@common/modules/forms/mail/form-text'], |
|
|
|
|
['items' => $messageItems] |
|
|
|
|
) |
|
|
|
|
->setTo($form->from) |
|
|
|
|
->setReplyTo(isset($form->reply) ? $form->reply : $form->from) |
|
|
|
|
->setTo($to) |
|
|
|
|
->setFrom($from) |
|
|
|
|
->setReplyTo($reply) |
|
|
|
|
->setSubject($form->subject) |
|
|
|
|
->send(); |
|
|
|
|
if (!$sent) { |
|
|
|
|