Difference between mail and mailer?

I tried to program my advanced app to send email.

Initially, I tried


But it failed to send. Then I switched to


And it sent without any issue.

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


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