How to send mail on Linux

How to send mail on Linux

To send emails on linux to other remote email addresses, we will first need to install the postfix server and mail command via the following command:

sudo apt-get install mailutils  # For debain & Ubuntu

During the installation, a prompt similar to this should pop up:
Postfix-Configure

This the configuration panel for postfix, and for our case, we need to select the option Internet Site.

If you accidentally falsely configure postfix, you can reconfigure it via the command:

sudp dpkg-reconfigure postfix

After finish installing mailutils, you now should be able to send an email! Try:

mail -s "Hello World!" YOUR@EMAIL << "Across the Great Wall we can reach every corner of the world."

For further detail into the mail command, you can use man mail to explore all the options it has.

Subscribe to TheXYZLab Blog

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe