Config mail.ru smtp
This commit is contained in:
parent
5469a209a5
commit
233a8a6d10
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
return [
|
return [
|
||||||
'adminEmail' => 'supp0rt.friday@yandex.ru',
|
'adminEmail' => 'chancellery@itguild.info',
|
||||||
];
|
];
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
return [
|
return [
|
||||||
'adminEmail' => 'supp0rt.friday@yandex.ru',
|
'adminEmail' => 'chancellery@itguild.info',
|
||||||
'supportEmail' => 'supp0rt.friday@yandex.ru',
|
'supportEmail' => 'chancellery@itguild.info',
|
||||||
'senderEmail' => 'supp0rt.friday@yandex.ru',
|
'senderEmail' => 'chancellery@itguild.info',
|
||||||
'senderName' => 'Friday.support mailer',
|
'senderName' => 'Chancellery ITguild mailer',
|
||||||
'user.passwordResetTokenExpire' => 3600,
|
'user.passwordResetTokenExpire' => 3600,
|
||||||
'user.passwordMinLength' => 8,
|
'user.passwordMinLength' => 8,
|
||||||
];
|
];
|
||||||
|
10
common/mail/signup-html.php
Normal file
10
common/mail/signup-html.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $user common\models\User */
|
||||||
|
|
||||||
|
?>
|
||||||
|
Hello <?= $user->username ?>,
|
||||||
|
|
||||||
|
You have successfully registered!
|
||||||
|
|
10
common/mail/signup-text.php
Normal file
10
common/mail/signup-text.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $user common\models\User */
|
||||||
|
|
||||||
|
?>
|
||||||
|
Hello <?= $user->username ?>,
|
||||||
|
|
||||||
|
You have successfully registered!
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
return [
|
return [
|
||||||
'adminEmail' => 'supp0rt.friday@yandex.ru',
|
'adminEmail' => 'chancellery@itguild.info',
|
||||||
];
|
];
|
||||||
|
@ -8,7 +8,7 @@ $params = array_merge(
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
'id' => 'app-frontend',
|
'id' => 'app-frontend',
|
||||||
'name' => 'Guild',
|
'name' => 'itGuild',
|
||||||
'basePath' => dirname(__DIR__),
|
'basePath' => dirname(__DIR__),
|
||||||
'bootstrap' => ['log'],
|
'bootstrap' => ['log'],
|
||||||
'controllerNamespace' => 'frontend\controllers',
|
'controllerNamespace' => 'frontend\controllers',
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
return [
|
return [
|
||||||
'adminEmail' => 'supp0rt.friday@yandex.ru',
|
'adminEmail' => 'chancellery@itguild.info',
|
||||||
];
|
];
|
||||||
|
@ -45,24 +45,15 @@ class ContactForm extends Model
|
|||||||
/**
|
/**
|
||||||
* Sends an email to the specified email address using the information collected by this model.
|
* Sends an email to the specified email address using the information collected by this model.
|
||||||
*
|
*
|
||||||
* @param string $email the target email address
|
|
||||||
* @return bool whether the email was sent
|
* @return bool whether the email was sent
|
||||||
*/
|
*/
|
||||||
public function sendEmail($email)
|
public function sendEmail()
|
||||||
{
|
{
|
||||||
return Yii::$app->mailer->compose()
|
return Yii::$app->mailer->compose()
|
||||||
->setTo($this->email)
|
->setTo($this->email)
|
||||||
->setFrom([Yii::$app->params['senderEmail'] => Yii::$app->params['senderName']])
|
->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();
|
||||||
|
|
||||||
// return Yii::$app->mailer->compose()
|
|
||||||
// ->setTo($email)
|
|
||||||
// ->setFrom([$this->email => $this->name])
|
|
||||||
// ->setSubject($this->subject)
|
|
||||||
// ->setTextBody($this->body)
|
|
||||||
// ->send();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,28 @@ class SignupForm extends Model
|
|||||||
$authorRole = $auth->getRole('user');
|
$authorRole = $auth->getRole('user');
|
||||||
$auth->assign($authorRole, $user->id);
|
$auth->assign($authorRole, $user->id);
|
||||||
|
|
||||||
return $user->save() ? $user : null;
|
if ($user->save()) {
|
||||||
|
$this->sendEmail($user);
|
||||||
|
return $user;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends an email with a link, for resetting the password.
|
||||||
|
*
|
||||||
|
* @return bool whether the email was send
|
||||||
|
*/
|
||||||
|
private function sendEmail(User $user)
|
||||||
|
{
|
||||||
|
return Yii::$app->mailer->compose(
|
||||||
|
['html' => 'signup-html', 'text' => 'signup-text'],
|
||||||
|
['user' => $this]
|
||||||
|
)
|
||||||
|
->setFrom([Yii::$app->params['senderEmail'] => Yii::$app->name . ' robot'])
|
||||||
|
->setTo($user->email)
|
||||||
|
->setSubject('Account registration at ' . Yii::$app->name)
|
||||||
|
->send();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user