configurationsendmail只使用一个出站MTA

我有一个sendmail的问题,我什么都不是一个sendmail的大师 – 我可以使用一些帮助。

我的问题是,我有一个或多或less是一个“设备”的系统 – 它不打算有一个pipe理员。 正因为如此,它需要能够通过发送电子邮件“打电话给家”。 正如我们configuration它,这工作正常 – 使用sendmail,它通过查找MXloggingfind适当的中继,一切工作正常。

但是,现在,由于安全问题,我们希望将其限制为仅使用一个中继,例如relay.corp.example.com 。 如果用户将其configuration为使用fubar.example.com ,则邮件发送应该失败或被延迟。

我以为通过configuration一个/etc/mail/server.switch文件包含的/etc/mail/server.switch

 hosts files 

没有dns ,我会得到这个效果。 这不起作用 – 相反,如果邮件发送到[email protected] ,它将尝试直接与example.com通话,并忽略configuration的服务器。

有任何想法吗?

更新

好吧,我试验性地把这两个scheme都绑在一起,而且他们似乎都有效。 希望我能标记他们都是正确的。

你使用m4来build立你的sendmail.cf吗? 如果是这样,你应该添加

 define(`SMART_HOST',`relay.corp.example.com') 

到你的sendmail.mc并重新生成你的sendmail.cf 。 它看起来像添加

 DSrelay.corp.example.com 

sendmail.cf权利也将做的伎俩。

这是一个SuSE系统的M4文件,用于将所有电子邮件转发到中继主机。
(也包括在SuSE发行版中)。 你只需要做m4 x.mc> x.cf,其中x.mc是下面的文件,x.cf将是replacesendmail.cf文件的文件(通常在/etc/sendmail.cf或/ etc / mail / sendmail.cf)。

  divert(-1) # # Copyright (c) 1999 SuSE GmbH Nuernberg, Germany. # Copyright (c) 2006 SuSE LINUX Products GmbH, Germany. # Author: Werner Fink # Please send feedback to http://www.suse.de/feedback/ # # This is a special case -- it creates a stripped down configuration # file containing nothing but support for forwarding all mail to a # central hub via a local SMTP-based network. The argument is the # name of that hub. # include(`/usr/share/sendmail/m4/cf.m4') divert(0)dnl VERSIONID(`@(#)Setup for SuSE Linux 0.2 (SuSE Linux) 2002/01/14') dnl dnl This is the default configuration for SuSE Linux. dnl See /usr/share/sendmail/ostype/suse-linux.m4 dnl and /usr/share/sendmail/README for more information. dnl OSTYPE(`suse-linux')dnl dnl dnl A stripped down configuration. Replace the mailhub.domain.notused dnl with your real mailhub. dnl FEATURE(`nocanonify')dnl FEATURE(`nullclient', `relay.corp.example.com')dnl dnl dnl This line is required for formating the /etc/sendmail.cf dnl LOCAL_CONFIG