Difference between mail and mailer?

I tried to program my advanced app to send email.

Initially, I tried


\Yii::$app->mailer->...

But it failed to send. Then I switched to


\Yii::$app->mail->...

And it sent without any issue.

What is the inherent difference between this two? The official Yii2 Guide uses mailer instead of mail.

Thanks.

I am not sure where that mail component comes from can you please paste your config then I can tell you what the difference.