With the minimum installation of any Linux operating system, you will not see most of the commands in your system. In minimum operating system installation only required packages are installed for running an operating system and skipped unnecessary packages. mail command is useful for sending emails from Linux command line which is used for almost Linux operating system. Most of Debian based systems will show error like “The program ‘mail’ is currently not installed. You can install it by typing”
There are many other alternatives to mail command for sending emails from Linux command line interface. Visit here for more options.
Install mail Command:
Let’s use one of below command to install mail command as per your operating system. For RHEL based systems, this command installed from mailx rpm packages and on Debian based system this command found in mailutils package.
Install mail command on CentOS/Redhat 7/6/5:
yum install mailx
Install mail command on Fedora 22+:
dnf install mailx
Install mail command on Ubuntu/Debian/LinuxMint:
sudo apt-get install mailutils
Sending Test Email
After installing mail command packages in your system, send a test email using below command.
echo "Message Body" | mail -s "Message Subject" [email protected]
Hi Rahul,
I have installed AMAZON ec2-instance on which I have installed Postfix email service.
I am not able to send emails using Postfix.
Can you help?
I installed the package, and it’s asking for a “postfix configuration.” I can’t select anything. Help!
Never mind. I solved it.
hi,
i am not able to send mail with non root user
Mr. Bharath
First to send some email, pleas check if you have a tiny file “.mailrc” in $HOME of this “non root user”.
Fill the file “.mailrc” with:
set smtp=smtp.puthereyoursmtpserver
set ssl-verify=ignore
set [email protected]
set font-family:monospace
enjoy