HostOnNet Blog

Sending mail from command line

To debug email servers, you may need to quickly send a test email from command line, then check the logs. You can use mail command to send mail. But you need to fill multiple fields.

On Ubuntu/Debian, you need to install mailutils package

apt install -y mailutils

Here is one line command to send email from terminal.

echo "This email body" | mail -s "test email from `hostname`"

You can use -v option to verify/debug

echo "This email body" | mail -v -s "test email from `hostname`"


Mail Server Solutions

Related Posts

Posted in Linux