[Solved] -bash: mail: command not found in Redhat CentOS Amazon EC2


By default, Amazon EC2 has not prepacked with mail utilities. So whenever you tried to send a mail from command line, you will get an error message that says: -bash: mail: command not found. Its because of you don't have required mail packages.



Copy and paste the following command to install mailutils in Amzon EC2.
sudo yum install mailx

Now test it by sending a mail from command line.
echo "This will go into the body of the mail." | mail -s "Testing from EC2." you@example.com

Note: Change you@example.com to your email address.

We Would Like To Hear From You..