Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
glpzzz committed May 20, 2019
1 parent a94efcc commit c3e3dfa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
20 changes: 12 additions & 8 deletions models/ContactForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,30 @@ public function rules()
public function attributeLabels()
{
return [
'name' => Yii::t('app', 'Name'),
'email' => Yii::t('app', 'Email'),
'subject' => Yii::t('app', 'Subject'),
'body' => Yii::t('app', 'Body'),
'lastname' => Yii::t('app', 'Lastname'),
'name' => Yii::t('contact', 'Name'),
'email' => Yii::t('contact', 'Email'),
'subject' => Yii::t('contact', 'Subject'),
'body' => Yii::t('contact', 'Body'),
'lastname' => Yii::t('contact', 'Lastname'),
];
}

/**
* Sends an email to the specified email address using the information collected by this model.
*
* @param string $email the target email address
* @param string $email the target and source email address
* @return bool whether the email was sent
*/
public function sendEmail($email)
{
return Yii::$app->mailer->compose()
->setTo($email)
->setFrom([$this->email => $this->name])
->setSubject($this->subject)
->setFrom([$email => Yii::$app->name])
->setReplyTo([$this->email => $this->name])
->setSubject($this->subject ?: Yii::t('contact', '{name} in {website}', [
'name' => $this->name,
'website' => Yii::$app->name
]))
->setTextBody($this->body)
->send();
}
Expand Down
7 changes: 5 additions & 2 deletions views/default/contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;

$this->title = 'Contact';
$this->params['breadcrumbs'][] = $this->title;
if (!$renderPartial) {
$this->title = 'Contact';
$this->params['breadcrumbs'][] = $this->title;
}

?>
<div class="site-contact">

Expand Down

0 comments on commit c3e3dfa

Please sign in to comment.