When SendMail ignores the mailertable

Sometimes SendMail behaviours are definitely strange.

Lately I moved my mail server from one machine to another, both running FreeBSD (6.0 the old one and 6.2 the new one) and both running DBMail as mail backend. Everything went smoothly… apart from the fact that just one domain wasn’t working.

Let’s step back a second. DBMail plugs into SendMail by using the mailertable standard. There you say that any mail for a specific domain has to be routed trough a different delivery service instead of the standard local one (SendMail‘s internal). Thus I have no users and domain configured in SendMail as everything gets forwarded to DBMail. This is easily done by adding the following code to /etc/mail/mailertable:


brancatelli.it dbmail:brancatelli.it
ragedrecords.com dbmail:ragedrecords.com
raged.it dbmail:raged.it

Pretty simple: if you receive mail for domain brancatelli.it forward it to dbmail as mail for domain brancatelli.it. Everything was working but one domain: brancatelli.it. Every time I tried to send any mail to anything@brancatelli.it SendMail was trying to deliver mail locally (read: internally) and thus was reporting an “User unknown” error to the remote mail server.

To make a long story short the problem is that SendMail define a special class of domains called “Class L”. Domains in this class are treated as special local domains that override any other definition from mailertable or such. Now the funny thing is that SendMail‘s default behaviour is to include localhost’s FQDN in the Class L (actually it makes some sense) and to lookup in the DNS the corresponding MX records for this host (thus even if the localhost name was carota.brancatelli.it he considered brancatelli.it as a local domain because he was listed as the MX for that domain – a very interesting assumption, I’d say). To override this behaviour you can just create an empty /etc/mail/local-host-name (the file used to override the Class L definitions) and you’re done.

…but!

(there’s always a “but”)

Be careful! When I say “EMPTY” /etc/mail/local-host-name I really mean EMPTY. I mistakenly created the file by including a white line inside, and for some reason I really don’t know (and actually really don’t care about) SendMail probably assumed the file was garbled and ignored it.

It took me almost two days to find out that this was the problem, so pay real attention to it.

Rispondi

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione /  Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione /  Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione /  Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione /  Modifica )

Connessione a %s...

This site uses Akismet to reduce spam. Learn how your comment data is processed.