System Administration
Showing results for 
Search instead for 
Did you mean: 

Re: How to configure sendmail relay server

Go to solution
Frequent Advisor

How to configure sendmail relay server


I need your help to configure a sendmail relay server on linux. My requirement is,

I have few linux servers say serverA, serverB and serverC ( where sendmail was installed). Now, I would like to make serverC as a relay server so all the emails sent from serverA, serverB ( or all the servers in this subnet) would send / direct emails to serverC and from where it would send emails to the exchange server and then will receive those emials to our outlook mailbox.

Could someone explain how to make this configuration on serverC?

I found some information on Google that I will need to go into /etc/mail/access on serverC and then edit as
serverA RELAY
serverB RELAY
10.8.16. RELAY

Is this ok? how does serverA, serverB knows that serverC is a relay or sent emails?

Appreciate your help on this

Honored Contributor

Re: How to configure sendmail relay server

Your /etc/mail/access configuration looks OK to me. But remember that usually you'll have to translate the human-readable /etc/mail/access file into a machine-readable /etc/mail/access.db (or something similar) to make the changes take effect.

Depending on the Linux distribution, this might happen automatically when you restart sendmail, or you might have to do it yourself. If there is a file named "Makefile" in the /etc/mail directory, this might be as simple as:

cd /etc/mail

If there is no /etc/mail/Makefile, you may have to learn how to use the "makemap" command; see "man makemap". Also search through your distribution documentation using keywords "sendmail" and "makemap".

To make serverA and serverB send everything to serverC instead of trying to deliver them directly to destination, you need to set a "smarthost" on serverA and serverB.

In /etc/mail/ file, there is a line that normally contains only the letters "DS" like this:


To make serverC the smarthost for this server, you change this line to:

(i.e. "" is supposed to be the fully-qualified domain name for serverC.)

In some Linux distributions, you are not supposed to edit /etc/mail/ directly: in those distributions, is automatically rewritten each time Sendmail is patched or updated. In that case, there should be a file that is used to generate the To add a smarthost configuration through, add a line like this to


Note the special single quotes used with the parameters: the processing is extremely strict about proper syntax.

Then find the command that regenerates the based on It depends on distribution: it might be as simple as running "make" in the directory that contains the, or it might be something like "m4 <".

Exalted Contributor

Re: How to configure sendmail relay server

Shalom, has a smart relay option which is pretty much self documented but requires m4 macro generation to generate a new file.

Simple DS relay is possible by un-commenting the DS section of and merely restarting the sendmail daemon.

For more see

Steven E Protter
Owner of ISN Corporation