Friday, May 1, 2009

Setting envelope-from on Ubuntu

After my Jaunty Jackalope upgrade, at work, some of my command-line mail tests were bouncing. Why? My sending address didn't have a Fully-Qualified Domain Name (FQDN). Some sites bounce mail that doesn't have a valid domain name in the field.

Sure enough, dnsdomainname returned ... nothing. And uname -a gave me a machine name, but not an FQDN.

I use Gmail for almost all my routine email, at home and at work. Gmail doesn't complain.

I also use command-line email in shell scripts, but that stays inside my LAN, which doesn't care about FQDNs either. I could probably have lived with the problem, but I wanted it fixed so I started poking.

I set the domain in /etc/hosts. That fixed the output of dnsdomainname,
and the From: field in the email was set correctly.

But not the mail problem. Envelope-from was still wrong. The mail to my test, outside hosts still bounced with the same complaint.

I restored the old hosts file and got Dean, our sysadmin, to give my machine a domain name through DNS. That was a little more work but it worked ... and also didn't solve the mail problem.

Finally, I stumbled over /etc/mailname. Putting an FQDN in there does the trick. The man page provides details.

No comments: