Operating System - Linux
1748270 Members
3866 Online
108760 Solutions
New Discussion юеВ

How to configure sendmail relay server

 
SOLVED
Go to solution
shankar!
Frequent Advisor

How to configure sendmail relay server

Greetings,

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

thanks
2 REPLIES 2
Matti_Kurkela
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
make

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/sendmail.cf file, there is a line that normally contains only the letters "DS" like this:

DS

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

DSserverC.full.name.example

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

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

define(`SMART_HOST',`[serverC.full.name.example]')dnl

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

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

MK
MK
Steven E. Protter
Exalted Contributor
Solution

Re: How to configure sendmail relay server

Shalom,

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

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

For more see http://sendmail.org

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com