How To Configure Linux To Send email

 

First of all, the server you want to mail must have the right to mail.

You can get help from the Exhange team.

 

Search Repo

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

We then check to see if MailX is in the repository with the command below.

 

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.

 

Install Mailx

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 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.

 

Restart Service

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

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