I have an ubuntu 16.04 web server with a forwarded mx record. On server, I installed sendmail. I have multiple vhosts runnning. One of them is "xxx-tele.com".
Now I want to setup sendmail that all mails sent to [email protected] should be forwarded to [email protected] which is a mailbox on a different mail server inside of my network.
First I added a /etc/mail/virtusertable with
[email protected] [email protected]
and with "makemap hash virtusertable.db < virtusertable" I created the hash file. In /etc/mail/sendmail.mc I added the line
FEATURE(`virtusertable', `hash -o /etc/mail/virtusertable.db')dnl
and I run the
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
command and restarted sendmail with "service sendmail reload".
Now, I try command
sendmail -bv [email protected]
and I just get response: [email protected]... User unknown
The xxx-tele.com is appended in /etc/hosts and in /etc/mail/local-host-names
How can I setup sendmail to just forward this address and refuse all other?
The command: echo '$=w' | sendmail -bt just returns:
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]
Best, dwi
here are the provided information: The answer for 1.) is
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> map_lookup: virtuser ([email protected]) returns [email protected] (0)
The answer for 2.) is
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
The third response is:
> 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
My host file is like:
127.0.0.1 localhost localhost.xxx.com xxx-tele.com
local.dmz.ip4.address web.xxx.com web xxx-tele.com
Sendmail: debugging virtusertable
1) Check if sendmailcan access the entry in virtusetable
As root execute:
2) Check if sendmail conducts virtusertable lookups for the email.
As root execute:
-d60.5 traces (all) maps lookups including virtusertable lookups
3) If the domain is rewritten by
host
map lookup before virtusertable lookups then check DNS lookups and post/etc/hots
entries withxxx-tele.com
Domain gets rewritten by host map lookup before virtusertable lookup
as indicated by debug output provided by
Changing your /etc/hosts entry should fix it