code: public function send(MailerInterface $mailer = null)
      {
          if ($mailer === null && $this->mailer === null) {
              $mailer = Yii::$app->getMailer();
          } elseif ($mailer === null) {
              $mailer = $this->mailer;
          }
  
          return $mailer->send($this);
      }
docs: Sends this email message.
  @param MailerInterface $mailer the mailer that should be used to send this message.
  If no mailer is given it will first check if [[mailer]] is set and if not,
  the "mailer" application component will be used instead.
  @return bool whether this message is sent successfully.