How to call Swift mailer in yii2 with console controller?
<pre><code>Yii::$app
          -&gt;mailer
          -&gt;compose(
              ['html' =&gt; 'remainder-html', 'text' =&gt; 'remainder-text'],
              ['user' =&gt; $user,'interview'=&gt;$interview]
          )
          -&gt;setFrom([Yii::$app-&gt;params['supportEmail'] =&gt; Yii::$app-&gt;name . ' robot'])
          -&gt;setTo($user-&gt;email)
          -&gt;setSubject('Contact Request From ' . $model-&gt;name)
          -&gt;send();
</code></pre>

<p>Above is the code I have used in console/controller for advanced app in yii2. Rest of things are working only the mail is not working. Same code work when placed in backend/frontend controller. Following is the error. </p>

<blockquote>
  <p>PHP User Error 'yii\base\ErrorException' with message 'Call to
  undefined method compose'</p>
</blockquote>