Installation
sudo apt install mailutils # [On Debian, Ubuntu and Mint]
sudo yum install mailx # [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux]
sudo emerge -a mail-client/mailx # [On Gentoo Linux]
sudo pacman -S mailutils # [On Arch Linux]
sudo zypper install mailutils # [On OpenSUSE]
Text Mail
echo "MAIL BODY" | mail -s 'MAIL SUBJECT' receiver@domain_name
# Enter DOT or Ctrl-d to exit the CLI
mail -s "Test mail" receiver@domain_name
HTML Mail
Way 1
NOTE: Doesn't work with Notes mail client
echo "<b>HTML Message goes here</b>" | mail -s "$(echo -e "This is the subject\nContent-Type: text/html")" receiver@domain_name
Functions
# Show_head & Gen_asr_report are custom functions.
Send_mail() {
subject="This is Mail Subject"
email="user@email.com"
echo -e "
### Attention: Do not reply to this message. ###
$(Show_head)
$(Gen_asr_report)
NOTE: The symbol '<<<' indicates an ASR(answer-seizure ratio) of less than $thre%.
" | /usr/bin/mail -s "$subject" "$email"
}