我想知道如果你能帮助我可能是一个简单的问题,但我似乎无法弄清楚。
我们有一些运行sendmail(所有内部服务器在本地局域网)的centos服务器 – 一个非常简单的sendmailconfiguration(所有默认设置),除了一个中继的一切到我们的交换服务器选项,即DSourexchangeserver现在我想要做的是有这些centos服务器sendmailconfiguration只接收邮件发往我们公司的域名,即[email protected]我不希望邮件转发到其他地方。 有没有办法让sendmail检查传递给它的邮件,而只是把它们转发到我们的交换服务器上,以符合注定我们公司域名的要求,并停止其他一切?
请参阅: http : //www.sendmail.org/tips/relaying
最简单的方法是将您愿意中继的域列出在/ etc / mail / relay-domains文件中。 此文件中列出的任何内容都将被接受进行中继。 注意:在修改这个文件后,必须重新启动Sendmail。
在这个页面上的这个和其他技巧应该让你开始。 否则,如果需要控制谁可以中继电子邮件,则可能需要检入SMTP AUTH。
relay-domains的问题在于,如果发送系统在该域中,则允许中继。
使用访问数据库可能是解决scheme。 在里面放:
要:mycompaniesdomain.com继电器
一定要closures所有其他的继电器选项。 Sendmail是一个复杂的野兽,它可能是好的发布你的MC文件。
你不需要更多的时间。 你可以通过sendmail.mc来完成。 将这些行添加到sendmail.mc中:
#Define the smart host define(`SMART_HOST', `exchange server here')dnl #Define a class of domains we want to relay to the smart host C{Exchange} example.com example.org #Decide whether to delete outgoing email or not LOCAL_RULE_0 #test the behavior of your system to see if you need the following line R$* < @ $=w . > $* $#OK R$* < @ $={Exchange} . > $* $#OK R$* $#local $: bit-bucket
在/ etc / mail / aliases中,位桶应该被别名为/ dev / null:
bit-bucket: /dev/null
记得在之后从sendmail.mv文件重buildsendmail.cf并重新启动sendmail。 我不知道CentOS如何做到这一点。 Debian的sendmailconfg让我有些懒惰。 还要记住,sendmail规则是分开的,而不是空格,所以不要复制粘贴。 手动键入LOCAL_RULE_0并用制表符分隔“左”和“右”部分。
这是我如何设置:
1个sendmail服务器,所有来自nix机器的电子邮件都会被发送到交换服务器,具体取决于邮件的绑定位置。
所有客户端的sendmailconfiguration都为上面的服务器提供了一个DS选项。
在1个sendmail服务器上(即所有的sendmailconfiguration都将指向DS选项,它将作为filter执行以下操作:
请确保在/etc/mail下的sendmail.mc包含: Feature('mailertable', 'hash -o /etc/mailertable.db' dnl line in it。
DAEMON_OPTIONS(``Port=smtp,Addr=127.0.0.1, Name=MTA')dnl (这样它可以中继所有机器 – 显然这对于一个拥有公共的机器来说不是个好主意知识产权 – 但那不是我在这里做的)
vi mailertable并放在以下行: yourdomain.com ESMTP:[yourexchangeserverip]
在/etc/mail下创build一个名为relay-domains并放在以下行: yourdomain.com
运行m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
运行makemap hash /etc/mail/mailertabledb < /etc/mail/mailertable
启动或重新启动sendmail守护进程,/ /etc/init.d/sendmail restart sendmail /etc/init.d/sendmail restart
然后,在所有想要使用电子邮件filter的机器上,进入sendmail.cf并将DS选项设置为上面的服务器的IP或主机名。 然后重新启动sendmail。