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.
yum search mailx
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.
yum install mailx
After you install MailX, you need to define your mail server on your system.
First you shoul open main.cf 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.
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“.
service postfix restart