Adjusted email headers in contact form
See https://github.com/yiisoft/yii2-app-advanced/issues/426
This commit is contained in:
parent
b4b51a3fb9
commit
e38c34a935
@ -2,4 +2,6 @@
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
'adminEmail' => 'admin@example.com',
|
'adminEmail' => 'admin@example.com',
|
||||||
|
'senderEmail' => 'noreply@example.com',
|
||||||
|
'senderName' => 'Example.com mailer',
|
||||||
];
|
];
|
||||||
|
@ -52,7 +52,8 @@ class ContactForm extends Model
|
|||||||
if ($this->validate()) {
|
if ($this->validate()) {
|
||||||
Yii::$app->mailer->compose()
|
Yii::$app->mailer->compose()
|
||||||
->setTo($email)
|
->setTo($email)
|
||||||
->setFrom([$this->email => $this->name])
|
->setFrom([Yii::$app->params['senderEmail'] => Yii::$app->params['senderName']])
|
||||||
|
->setReplyTo([$this->email => $this->name])
|
||||||
->setSubject($this->subject)
|
->setSubject($this->subject)
|
||||||
->setTextBody($this->body)
|
->setTextBody($this->body)
|
||||||
->send();
|
->send();
|
||||||
|
Loading…
Reference in New Issue
Block a user