2

I need to provide the name of a relay server to my sendmail configuration file. This server name is however configurable via another system/application.

In case of a change, i need to change the server name in this file and restart sendmail.

Also, i dont have the option of compiling the sendmail.mc file everytime it changes.

Is it possible to ask sendmail to read/include another file for the server name. This file will contain the name of the server which has been configured in the system?

something like: include("./severname.conf");

where servername.conf will have the name of the server to which relaying needs to be done.

Is it possible?

1
  • I hope i have been able to post my query properly. In case its not clear please let me know, so that i may try to explain more on this requirement
    – chingupt
    May 17, 2013 at 11:58

2 Answers 2

1

The smart host is macro $S so you need a sequence of commands like this:

cd /etc/mail
cp sendmail.cf sendmail.cf.old
sed -e 's/^DSold.host.name/DSnew.host.name/' sendmail.cf.old > sendmail.cf 

and then restart sendmail.

1

You may use default route in mailertable instead of smart host - see FEATURE(mailertable). It will be consulted/used before smart host => it will override smart host.

mailertable file entry for default route ("single dot" as key):

.  relay:smart-host.example.net

Sendmail uses version of the file compiled using makemap program. No restart of sendmail daemon is needed after recompilation by makemap.

How to test it:

sendmail -C/etc/mail/sendmail-test.cf -d60.5 -bv [email protected]

-C file - use alternative configuration file
-d60.5 - turn on tracking map lookups (including mailertable map)

1
  • Any operation that rebuilds a .db file via makemap does not require a sendmail restart (newaliases, virtusertable, mailertable, etc.)
    – adamo
    May 18, 2013 at 7:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .