Monday , May 20 2024

send mail from linux using mailx

This article contains information about send mail from linux using mailx, mailx linux installation, configure mailx.

First of all, the server you want to send mail from must have the permission to sed mail.

You can get help from the Exhange team.

mailx Linux Installation

We are connecting to the server as root, which we will do the mail configuration.

We then check if there is mailx in the repository with the below command.

If the mailx is not in the repos, you can also download it from the internet. But it would be more correct to ask your system team to do this.

Then we install mailx with the following command.

Configure Mailx

After you install MailX, you need to define your mail server on your system.

First you shoul open file with below command

After running the above command, we press shift and 7 together to search for the parameter we want to change in the file, and write relayhost.

After you press Enter, you can continue searching with n until you find what you are looking for.

After you find the line you are looking for, if you press yy and then p on that line, that line will be copied as a new line.

We then remove the # sign at the beginning of the new line and press the insert key from the keyboard.

Then, on the screen below, you are writing your email server where the white box appears.

You can get the necessary information from your Exchange team.

Then press the esc key on the keyboard and type :wq to save the file and press the enter key to exit.

Restart Service

Then you must restart Postfix with the command below. You can now send mail from linux using mailx.

You can find information on how to send mail to from the article named “How To Send Disk Usage as email On Linux“.


About dbtut

We are a team with over 10 years of database management and BI experience. Our Expertises: Oracle, SQL Server, PostgreSQL, MySQL, MongoDB, Elasticsearch, Kibana, Grafana.

Leave a Reply

Your email address will not be published. Required fields are marked *