[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: No to localhost.localdomain

Robert Storey wrote:
> I'm experimenting with mail. At the moment, when I send mail (either
> locally, or out over the Internet) with the "mail" command, it always
> appears to come from "user@localhost.localdomain". I want to get rid of
> this "localhost.localdomain" stuff, replacing it with my own domain, but I
> cannot figure out how. I'm currently using Postfix, and I've been messing
> with the settings in /etc/postfix/main.cf.

Edit /etc/hostname and set your hostname appropriately.  If I wanted
to start a long debate I would say it should be a FQDN (Fully
Qualified Domain Name), e.g. "foo.example.com".  But Debian allows it
to be a short "local name only" name.  Whatever I were to suggest
there is a strong contingent who wish it the other way.

Edit /etc/mailname and set your hostname appropriately.  It must be
the fully qualified name of your system.

The default Debian config is to set 'myorigin = /etc/mailname'.  Which
is a Debian specific feature not normally found in Postfix.  I believe
this is done just for compatibility with other Debian MTAs which also
use /etc/mailname.  And also to support the notion that hostname might
be a short name which is not something which Postfix normally expects.
Postfix normally expects the hostname to be a FQDN.  If hostname is a
short name then it needs to get the fully qualified domain name from
someplace.  Hence the /etc/mailname file which must have a fully
qualified name and the hacks to postfix to read it.

You could also put the FQDN in the /etc/postfix/main.cf directly by
setting 'myhostname' to the FQDN.  For sites with a machine or three
that is fine and typical.  But since I maintain a couple of thousand I
like to keep that file identical across the set.

  postconf | grep -e '^mydomain' -e '^myhostname' -e '^myorigin'

What does the above command say?  It should say something like this:

  mydomain = proulx.com
  myhostname = torment.proulx.com
  myorigin = /etc/mailname

The above command dumps out the current configuration after being
processed by the main.cf file.  Use the -d option to print the
defaults before being changed by the main.cf file.  This way you can
see what the system would do without your configuration and
particularly if your configuration is actually breaking it.

  postconf -d | grep -e '^mydomain' -e '^myhostname' -e '^myorigin'

  mydomain = torment
  myhostname = torment
  myorigin = $myhostname

> I'm willing to switch to Exim, makes no difference to me as long as
> I get it to work, but I'd sure appreciate any advice on how to tweak
> this setting so that I am no longer localhost.localdomain.

Exim is also a good MTA and you will find a lot of support for it on
this list.  But since you have Postfix already you should at least
give it a good run.  I think you will find it quite a good.  I find
the "table driven" configuration of Postfix to be easier to work
with.  YMMV.


Attachment: pgpKlOERBgE6e.pgp
Description: PGP signature

Reply to: