I will show you get started with sending mails from the Linux command line. Will also cover sending attachments from the command line. We will begin with the “mail” command.
First we need to test the sendmail application to be installed and working correctly executing the following command:
echo “This is the body of mail.” | mail -s “Subject” [email protected]
Other command line option:
-s subject Specify subject on command line.
-c email-address Mark a copy to this “email-address”, or CC.
-b email-address Send blind carbon copies to list. List should be a comma-separated list of names.
Below are few examples that you can use with the mail command: