In a company environment, email is an essential component to the work day. Email is used to communicate with both internal employees and external customers. In exam you will be tested to configure the send mail server for you local LAN.
By default sendmail server allows to connect to local host only. So we should edit the /etc/mail/sendmail.mc file to allow connect to other hosts.
The sendmail daemon is configured from a directory of files in /etc/mail and a directory of configuration files in /usr/share/sendmail-cf. There are two basic configuration files:
- sendmail.cf The main sendmail configuration file.
- sendmail.mc A macro that’s easier to edit, which can be used to generate a new sendmail.cf file.
For this example we are using two systems one linux server one linux clients. These are the pre quest for a sendmail server
- A linux server with ip address 192.168.0.254 and hostname Server
- A linux client with ip address 192.168.0.1 and hostname Client1
- A Configured DNS server on Linux server
- Updated /etc/hosts file on both linux system
- Running portmap and xinetd services
- Firewall should be off on server
We suggest you to review that article and configure DNS server before start configuration of sendmail server. Once you have completed the necessary steps follow this guide.
Configure sendmail server
sendmail and m4 rpm are required to configure sendmail server check them for install if not found install them.
Mail server program reads the /etc/mail/sendmail.cf. To change the configuration on mail server, we should edit the /etc/mail/sendmail.mc file. When Sendmail is started or restarted with the service sendmail restart command a new sendmail.cf file is automatically generated if sendmail.mc has been modified. In exam you should generate it with m4 command.
open /etc/mail/sendmail.mc for editing.
show hidden line with : set nu option on vi command mode
By default, the following line limits sendmail access to connect local host only [line no 116]
You can allow other computers to use your sendmail server by commenting out this line.
In the sendmail.mc file , lines that begin with dnl, which stands for delete to new line, are considered comments. Some lines end with dnl, but lines ending in dnl are not comments
comment this line with dnl keyword followed by # sign
save this file with :wq and exit.
Now generate new sendmail.cf file by using m4 command as shown here
Now restart sendmail service and also set it on with chkconfig
if sendmail service restart without any error means you have configured sendmail successfully.