Gmail offers a great relay service but enforces security. But we need to make sure that our MTA has a reliable connection to a relay. Once you get things working, mail will just work. You can configure that MTA on your server once and forget it. The MTA must be configured to get the email out the door, off your Raspberry, and out to a mail relay.
It puts the email header and body together and then passes it off to an MTA or “mail transport agent”. Whether it be Sendmail or Nagios, is the MUA or “mail user agent”. There are actually quite a few moving parts to getting a message from your Raspberry to your Gmail account. If you’ve got a Gmail account, there’s a fairly straightforward way to allow your Raspberries access to your Gmail in a fairly secure fashion. But, because of all the spammers in the world, the email relays have gotten much more stringent of who could just dump email messages on their servers for delivery. Back in the day, you could just run Sendmail and pipe some text to your email address.
Wouldn’t it be nice to get an occasional email from one of your Raspberries when something is wrong? Maybe your filesystem is filling up or the monitoring you’ve set up needs to alert you that some of the network devices are overheating.