# mail loops back to me (MX problem?)



## mack3457 (Apr 27, 2021)

I'm running some servers for some time now and everything was fine until I updated from 12.1 to 12.2.

For some reason, the automatic "daily security run output" / "daily run output" mails didn't show up anymore then. Mail was never configured by myself but used out of the box, as it is ok to have those local mails only.

So I fiddled a little with sendmail, when mails about the delay of log-mails suddenly became delivered but not the log-mails themselves, as they couldn't be delivered due to "Deferred: Connection refused by xxx.yyy.de.".

Trying to send mail always ends up (in /var/log/messages) with:

`sm-mta[64691]: 13R95I9X064689: SYSERR(root): xxx.yyy.de. config error: mail loops back to me (MX problem?)`

and in the mails about the delivery failures:

`553 5.3.5 xxx.yyy.de. config error: mail loops back to me (MX problem?)
554 5.3.5 Local configuration error`

The original mails never get through. And this only happens, when I restart sendmail at least once - directly after reboot, not even the mails about the failure to deliver mails appear.

So, I'm rather confused.
- For one, there is no sendmail_enable="YES" or similar in rc.conf, but service sendmail onestatus tells me, it's running fine:

`root@is129:/etc/mail # service sendmail onestatus
sendmail is running as pid 1961.
sendmail_submit is running as pid 1961.
sendmail_msp_queue is running as pid 1964.`

- There are no mail deliveries after reboot, but when I restart sendmail, notification mails about unsuccessful mail delivery appear - but never the original mails.

- I checked for differences in mail related configuration with another freebsd 12.2 server, which is running fine, but I didn't find any.

Has anyone an idea about what might be the problem?

Thomas Mack


----------



## covacat (Apr 27, 2021)

check /etc/mail/local-host-names  (Cw)
you have to have your domain / host there. restart sendmail after


----------



## mack3457 (Apr 27, 2021)

There is no such file. And there is no such file on the other server, which is delivering mails without problems.


----------



## covacat (Apr 27, 2021)

sendmail.cw ?
sendmail behaves like that where the host on which runs  is the mx for a domain but the domain is not in class w (which is usually sendmail.cw or local-host-names)
the configured hostname (output of command hostname) and localhost are by default in class w


----------



## mack3457 (Apr 27, 2021)

There is no such file sendmail.cw either. I already tried the hostname in local-host-names, which resulted in hostname.cf / hostname.mc and hostname.submit.cf / .mf to be generated. But without any success.

The mx for the domain is a different server.

When I had checked hostname, it resulted in the hostname without domainname, so I reconfigured this via bsdconfig, but there was no change in behaviour there after.


----------



## covacat (Apr 27, 2021)

```
egrep '^(Cw|Fw)' /etc/mail/sendmail.cf

Cwlocalhost
Fw-o /etc/mail/local-host-names
```
that's on a vanilla 12.2 box


----------



## mack3457 (Apr 27, 2021)

Same her:
`egrep '^(*Cw|Fw)' /etc/mail/sendmail.cf
Cwlocalhost
Fw-o /etc/mail/local-host-names`


----------



## covacat (Apr 27, 2021)

just put the  name that loops back to you in /etc/mail/local-host-names and restart sendmail


----------



## mack3457 (Apr 27, 2021)

Ok, thanks - I put the hostname in local-host-names before, not the domainname.

With the domainname, it seems to work.


----------

