If you are using Linux Desktop Operating System and do not want to set up an email server, use GMail account to relay emails. On Desktop OS, we can use GUI Email Clients, which supports POP3/IMAP to send an email but how about /usr/bin/mail or from cmd prompt?
To fulfil your requirement, you need to install a simple program called ssmtp. It accepts a mail stream on standard input with recipients specified on the command line and synchronously forwards the message to the mail transfer agent of a mail hub for the mail hub MTA to process. Failed messages are placed in dead.letter in the sender’s home directory.