title: Yii 2: Unable to send log via mail
body: <p>This is my mailer component. 
  As you can see, because of my test purposes, I'm using email on file</p>
  
  <pre><code>'mailer' =&gt; [
          'class'             =&gt; 'yii\swiftmailer\Mailer',
          'viewPath'          =&gt; '@common/mail',
          'useFileTransport'  =&gt; true,
      ],
  </code></pre>
  
  <p>This is my log component.</p>
  
  <pre><code>'log'       =&gt; [
          'traceLevel' =&gt; YII_DEBUG ? 3 : 0,
          'targets'   =&gt; [
              [
                  // for this target, see http://www.yiiframework.com/doc-2.0/guide-runtime-logging.html
                  'class'         =&gt; 'yii\log\EmailTarget',
                  'levels'        =&gt; ['error'],
                  'categories'    =&gt; ['yii\db\*', 'email_test'],
                  'message'       =&gt; [
                     'from'           =&gt; ESHOP_EMAIL,
                     'to'             =&gt; DEVELOPER_EMAIL,
                     'subject'        =&gt; 'Errore db [' . YII_ENV . ']',
                  ],
              ],
          ],
      ],
  </code></pre>
  
  <p>In siteControlle->actionIndex() I'm testing log and email component in this way</p>
  
  <pre><code>public function actionIndex()
  {
      Yii::error("testing mail log", "email_test");
  
      Yii::$app-&gt;mailer-&gt;compose()
          -&gt;setFrom([ESHOP_EMAIL =&gt; ESHOP])
          -&gt;setTo( DEVELOPER_EMAIL)
          -&gt;setSubject("actionIndex executed on time " . date ("H:i:s"))
          -&gt;setTextBody("Useless body")
          -&gt;send();
  
      return $this-&gt;render('index');
  }
  </code></pre>
  
  <p>As i expect, at every reload of the index page I got 2 <code>.eml</code> files created inside <code>frontend/runtime/mail</code> folder.</p>
  
  <p>So SwiftMailer is working, and even the log system.</p>
  
  <p><strong>Now the problem</strong></p>
  
  <p>I try to remove use of file from <code>mailer</code> component, commenting the row</p>
  
  <pre><code>        'useFileTransport'  =&gt; true,
  </code></pre>
  
  <p>When I reload the index page, I got the SECOND MAIL, the one manually composed and sent, but I DO NOT RECEIVE the first mail, the one that should be automatically composed and sent by log system using SwiftMailer.</p>
  
  <p>What's wrong?</p>