In the Craft 3 Class Reference (https://docs.craftcms.com/api/v3), there are two classes under
I found that I was able to send an email using this:
<?php use craft\mail\Message; $message = new Message(); $message->setTo('firstname.lastname@example.org'); $message->setSubject("Hello world."); $message->setHtmlBody("Hello world."); $message->send();
But I found in some examples, like this one, that the email could be send using
Craft::$app->mailer->send($message) instead of
What's the difference between the Mailer and the Message classes? When should I use one instead of the other?