Procházet zdrojové kódy

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

Alexander Makarov před 11 roky
rodič
revize
91f05a2891

+ 1 - 1
config/web.php

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

+ 1 - 1
models/ContactForm.php

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

+ 2 - 2
tests/unit/models/ContactFormTest.php

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

+ 2 - 2
views/site/contact.php

@@ -22,9 +22,9 @@ $this->params['breadcrumbs'][] = $this->title;
     <p>
         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.
-        <?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
-        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>
         application component to be false to enable email sending.
         <?php endif; ?>