How to send a test email from the command line Ubuntu

If you have just installed Postfix or Sendmail it can be helpful to test if everything is configured correctly. Often you want to do this from the commandline without having to install an entire email client. You can do this by installing a few simple command line mail utilities.

apt-get update
apt-get install mailutils

Then pipe a message to the command:

echo testing | mail -s test_subject myemail@example.com

If the mail doesn’t arrive then you can reconfigure postfix and try again.

dpkg-reconfigure postfix

I hope this helps someone.

5 thoughts to “How to send a test email from the command line Ubuntu”

  1. When I do apt-get install mailutils it tells me there’s no such package. I’ve tried apt-cache search even, mailutils does not seem to exist.

Leave a Reply to Evan Shad Cancel reply