How to configure sendmail as a gateway

This is a simple how to about how to configure sendmail to act as a mail

This how to will only talk about 3 files: access, mailertable and

File relay-domains NOT included in sendmail distribution (at least in my
CentOS distribution), you have to create it manually.
All files (at least in my CentOS) located in directory /etc/mail

Access file
First, we put our host and our network to be able to relay through our
localhost.localdomain RELAY
localhost RELAY RELAY
192.168.1 RELAY
192.168.2 RELAY

If you use GreetPause feature, you can put no waiting for local email.
GreetPause:localhost 0
GreetPause:192.168.1 0
GreetPause:192.168.2 0

If you using DNSBL, and want to skip one or two domains from DNSBL check,
you can use this OK

Now for the big part.
Put all the domain that you want to relay BUT put it as REJECT. This way by
default all emails to that domain will be rejected unless we specify
otherwise – in this case OK. REJECT REJECT REJECT OK OK OK OK OK OK

Finish. For access file, you can use make -C /etc/mail to ‘compile’ it.

Mailertable file
Now put this entry in mailertable, so sendmail will know to where it will
route the emails. smtp:[] esmtp:[]

Finish. Do make -C /etc/mail to ‘compile’ it.

Relay-domains file.
Most forgotten file, I think because it’s not included in most
distribution. You have to create it manually. Simply as type touch
/etc/mail/relay-domains to create the file.

Now type all the domain that you want to relay.

Finish. Now restart the server.

Leave a Reply