sendmail.cf从另一个文件读取服务器名称?

我需要将中继服务器的名称提供给我的sendmailconfiguration文件。 该服务器名称可通过其他系统/应用程序进行configuration。

如果发生更改,我需要更改此文件中的服务器名称并重新启动sendmail。

此外,我没有编译sendmail.mc文件每次更改的选项。

是否有可能要求sendmail读取/包含服务器名称的另一个文件。 这个文件将包含在系统中configuration的服务器的名称?

像这样:include(“./ severname.conf”);

其中servername.conf将具有中继需要完成的服务器的名称。

可能吗?

智能主机是macros$S所以你需要这样的一系列命令:

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

然后重新启动sendmail。

您可以在mailertable中使用默认路由而不是智能主机 – 请参阅FEATURE(mailertable) 。 它将智能主机之前被查阅/使用=>它将覆盖智能主机。

默认路由的mailertable文件条目(“单点”作为键):

 . relay:smart-host.example.net 

Sendmail使用使用makemap程序编译的文件的版本。 通过makemap重新编译后,不需要重新启动sendmail守护进程。

如何testing:

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

-C file – 使用替代configuration文件
-d60.5 – 打开跟踪地图查找(包括mailertable地图)