我有一个转发mxlogging的Ubuntu 16.04 Web服务器。 在服务器上,我安装了sendmail。 我有多个虚拟主机runnning。 其中之一是“xxx-tele.com”。
现在我想设置sendmail,发送到[email protected]的所有邮件应该被转发到[email protected],这是我的networking内部不同邮件服务器上的邮箱。
首先我添加了一个/ etc / mail / virtusertable
[email protected] [email protected]
并用“makemap hash virtusertable.db <virtusertable”创build了散列文件。 在/etc/mail/sendmail.mc我添加了该行
FEATURE(`virtusertable', `hash -o /etc/mail/virtusertable.db')dnl
我跑了
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
命令并用“service sendmail reload”重新启动sendmail。
现在,我尝试命令
sendmail -bv [email protected]
我只是得到回应:[email protected] …用户未知
xxx-tele.com被添加到/ etc / hosts和/ etc / mail / local-host-names中
我怎样才能设置sendmail只是转发这个地址,并拒绝所有其他的?
命令:echo'$ = w'| sendmail -bt只是返回:
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked) Enter <ruleset> <address> > localhost.tele.com web xxx-tele.com [internal.dmz.ip4.address] localhost web.tele.com [127.0.0.1] web.tele.com [localhost.tele.com]
最好,dwi
这里是提供的信息:1.)的答案是
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked) Enter <ruleset> <address> > map_lookup: virtuser ([email protected]) returns [email protected] (0)
2)的答案是
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked) Enter <ruleset> <address> > canonify input: info @ xxx-tele.com Canonify2 input: info < @ xxx-tele.com > map_lookup(host, xxx-tele.com, %0=xxx-tele.com) => localhost.xxx.com. (0) Canonify2 returns: info < @ localhost.xxx.com . > canonify returns: info < @ localhost.xxx.com . > parse input: info < @ localhost.xxx.com . > Parse0 input: info < @ localhost.xxx. com . > map_lookup(dequote, info, %0=info) => NOT FOUND (0) Parse0 returns: info < @ localhost.xxx.com . > Parse1 input: info < @ localhost. xxx.com . > map_lookup(virtuser, [email protected], %[email protected], %1=info) => NOT FOUND (0) map_lookup(virtuser, @localhost.xxx.com, %[email protected], %1=info) => NOT FOUND (0) Parse1 returns: $# local $: info parse returns: $# local $: info
第三个回应是:
> root@web:~# _res.options = 812c3, HasWildcardMX = 0 Enter <ruleset> <address> > canonify input: info @ xxx-tele . com Canonify2 input: info < @ xxx-tele . com > Canonify2 returns: info < @ localhost . xxx. com . > canonify returns: info < @ localhost . xxx. com . > parse input: info < @ localhost . xxx. com . > Parse0 input: info < @ localhost . xxx. com . > Parse0 returns: info < @ localhost . xxx. com . > Parse1 input: info < @ localhost . xxx. com . > Parse1 returns: $# local $: info parse returns: $# local $: info
我的主机文件是这样的:
127.0.0.1 localhost localhost.xxx.com xxx-tele.com local.dmz.ip4.address web.xxx.com web xxx-tele.com
在virtusertable查找之前,域被主机映射查找重写
如由所提供的debugging输出所指示的
echo '3,0 [email protected]' | sendmail -d60.5 -bt
改变你的/ etc / hosts项应该修复它
### Old Entry # 127.0.0.1 localhost localhost.xxx.com xxx-tele.com ### New Entry 127.0.0.1 localhost xxx-tele.com
1)检查sendmailcan是否可访问virtusetable中的条目
以root身份执行:
echo /map virtuser [email protected] | sendmail -bt
2)检查sendmail是否对电子邮件进行虚拟引用查找。
以root身份执行:
echo '3,0 [email protected]' | sendmail -d60.5 -bt
-d60.5跟踪(全部)映射查找,包括虚拟引用查找
3)如果在 virtusertable查找之前通过host映射查找重写域,那么使用xxx-tele.com检查DNS查找和post /etc/hots条目
echo '3,0 [email protected]' | sendmail -d8.20 -bt