Hey! here is the solution for the below pasted error while you are trying to send emails by using a script.  You can simply fix this issue by installing the package mailx.

Error details:

mail: command not found

Solution:

yum install mailx
service postfix start
chkconfig postfix on

That’s it!