Fixes #4071: mail component renamed to mailer, yii\log\EmailTarget::$mail renamed to yii\log\EmailTarget::$mailer

This commit is contained in:
Alexander Makarov 2014-06-26 18:28:28 +04:00
parent 2193366f3f
commit 91f05a2891
4 changed files with 6 additions and 6 deletions

View File

@ -17,7 +17,7 @@ $config = [
'errorHandler' => [ 'errorHandler' => [
'errorAction' => 'site/error', 'errorAction' => 'site/error',
], ],
'mail' => [ 'mailer' => [
'class' => 'yii\swiftmailer\Mailer', 'class' => 'yii\swiftmailer\Mailer',
// send all mails to a file by default. You have to set // send all mails to a file by default. You have to set
// 'useFileTransport' to false and configure a transport // 'useFileTransport' to false and configure a transport

View File

@ -49,7 +49,7 @@ class ContactForm extends Model
public function contact($email) public function contact($email)
{ {
if ($this->validate()) { if ($this->validate()) {
Yii::$app->mail->compose() Yii::$app->mailer->compose()
->setTo($email) ->setTo($email)
->setFrom([$this->email => $this->name]) ->setFrom([$this->email => $this->name])
->setSubject($this->subject) ->setSubject($this->subject)

View File

@ -13,7 +13,7 @@ class ContactFormTest extends TestCase
protected function setUp() protected function setUp()
{ {
parent::setUp(); parent::setUp();
Yii::$app->mail->fileTransportCallback = function ($mailer, $message) { Yii::$app->mailer->fileTransportCallback = function ($mailer, $message) {
return 'testing_message.eml'; return 'testing_message.eml';
}; };
} }
@ -54,7 +54,7 @@ class ContactFormTest extends TestCase
private function getMessageFile() private function getMessageFile()
{ {
return Yii::getAlias(Yii::$app->mail->fileTransportPath) . '/testing_message.eml'; return Yii::getAlias(Yii::$app->mailer->fileTransportPath) . '/testing_message.eml';
} }
} }

View File

@ -22,9 +22,9 @@ $this->params['breadcrumbs'][] = $this->title;
<p> <p>
Note that if you turn on the Yii debugger, you should be able Note that if you turn on the Yii debugger, you should be able
to view the mail message on the mail panel of the debugger. to view the mail message on the mail panel of the debugger.
<?php if (Yii::$app->mail->useFileTransport): ?> <?php if (Yii::$app->mailer->useFileTransport): ?>
Because the application is in development mode, the email is not sent but saved as Because the application is in development mode, the email is not sent but saved as
a file under <code><?= Yii::getAlias(Yii::$app->mail->fileTransportPath) ?></code>. a file under <code><?= Yii::getAlias(Yii::$app->mailer->fileTransportPath) ?></code>.
Please configure the <code>useFileTransport</code> property of the <code>mail</code> Please configure the <code>useFileTransport</code> property of the <code>mail</code>
application component to be false to enable email sending. application component to be false to enable email sending.
<?php endif; ?> <?php endif; ?>