# make sendmail  use MX before A record



## dbi (Jun 8, 2010)

Hi,

I have a FreeBSD 8.0-p3 Release witn two virtual hosts and several jails.

The virtual hosts are "bsd.example.com" and "example.com".
The first is defined in /etc/rc.conf and DNS, the latter - only in DNS.
They have different private IP addresses.

One of the jails is "mail.example.com".
It corresponds to the MX DNS record and handles the mail for example.com with postfix and virtual accounts. No problems here.

The other jails have only 1 change in their mail configuration:
"root me@example.com" set in /etc/mail/aliases.
The mail from daemons running in those jails correctly goes to "me@example.com" which is actually handled by "mail.example.com"
No problems there either.

The problem appears when an account (daemon or user) tries to send mail from the host system (bsd.example.com) to "root". I guess it "sees" it is running on "example.com" and tries to deliver the mail locally without checking for the MX.
Of course this attempt fails miserably with error "no such local user: me@example.com".

So, please advise me how to make the sendmail program use the MX before the A record?


----------



## dbi (Jun 9, 2010)

crsd said:
			
		

> Check if you have example.com in /etc/mail/local-host-names, and if it is, remove it from that file.



No, there's no such file.


----------



## quintessence (Jun 18, 2010)

Hello,

Probably you have sendmail *daemon* enabled in bsd.example.com . 
Try to remove all sendmail_* related from your rc.conf and restart sendmail, all you need is defined in the default rc.conf .

Edit aliases on bsd.example.com , btw root: me@example ( with ":" ) and make newaliases , then try to send email from local user to root .


```
Jun 18 17:36:55 XXXX sendmail[53046]: o5IEatiI053046: to=root, ctladdr=bobi (2012/2012), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30024, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (o5IEatNO053047 Message accepted for delivery)

Jun 18 17:36:55 XXXX sendmail[53046]: o5IEatiI053046: from=bobi, size=24, class=0, nrcpts=1, 
msgid=<201006181436.o5IEatiI053046@XXXX.domain.name>, relay=root@localhost
Jun 18 17:36:55 XXXX sm-mta[53047]: o5IEatNO053047: from=<bobi@XXXX.domain.name>, size=363, class=0, nrcpts=1, 
msgid=<201006181436.o5IEatiI053046@XXXX.domain.name, proto=ESMTP, daemon=Daemon0, relay=localhost [Y.Y.Y.Y]
Jun 18 17:36:55 XXXX sendmail[53046]: o5IEatiI053046: to=root, ctladdr=bobi (2012/2012), delay=00:00:00, xdelay=00:00:00, mailer=relay, 
pri=30024, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (o5IEatNO053047 Message accepted for delivery)
```

where XXXX.domain.name is your bsd.example.com


----------



## dbi (Jun 19, 2010)

It appears the problem was that sendmail on the host system "sees" all aliased IP addresses on the interface and automatically tries to take care of the mail that goes through them. I don't know how to make it work on explicitly specified alias only, so I installed Postfix and now everything works fine. Postfix has a parameter called "inet_interfaces" for this thing.


----------

