That's the first time I'll configure a mail server. I explain you the complete picture. Currently, my company company.com has an old-win-2008-server-with-no-way-to-know-its-current-configuration-because-everything-is-pure-chaos, and we are migrating all of ours domains (about 40 little sites) to a new strato server with Ubuntu 12.04, to make things right.
About Linux administration, apache, permission and so on I've no problems. My lack of understanding is related to mail servers. I've learn a lot these days but I've some dubts about local delivery.
Specifically, I want to properly set the postfix parameters myorigin
, myhostname
, mydomain
and mydestination
, together with /etc/mailname
.
My default hostname is xxxx.stratoserver.net (the default hostname strato gives to us), but of course, our "standard domain" is company.com, and in the same server (we have only one), we will configure a bind9 server for our 40 sites, together with apache, postfix, dovecot, etc, etc, for these 40 sites.
Reading tutorials I see myorigin
is always set to something like mail.company.com (manually set or delegated to /etc/mailname). The first thing is, why mail.company.com and not just company.com? If a local message is generated for any of the process of the system, I want to send that email to whatever@company.com
and not to whatever@mail.company.com
.
If I change "hostname" to something related to company.com and not xxxx.stratoserver.net, there's no conflicts between both hostnames?
Where is local mails delivered to? Is that account accesible from outside? I mean, can I get local email by means of POP3/IMAP?, or it isn't a recommended practice for any reason? What will it happen if I change everything related to local mail to @localhost?
I know I make too much questions and questions have to be concrete in the stackexchange network, but this package of doubts can be resumed to "I would like to understand the whole picture of local mail/hostname/mailname", or at least, from the point of view of postfix/dovecot point of view.
NOTE: Although the @clement's answer was enough for me (nearly enough indeed, :P), this reading was very useful to finally understand the "whole picture": http://www.postfix.org/VIRTUAL_README.html
Best Answer
myorigin = mydomain.com
- The domain name to append when the UNIX user sends out a mail. (For eg. If UNIX userjohn
sends mail, thenjohn@mydomain.com
will be the sender address. If you want your sending domain to bemail.domain.com
set yourmyorigin
accordingly.myhostname = mail.mydomain.com
- The uniqueFQDN
of your mail server. When talking to other SMTP servers, it identifies itself asmail.mydomain.com
. There is no necessity that your system name should match themyhostname
value of postfix.mydomain = mydomain.com
The primary domain that your mail server belongs to.mydestination = mydomain.com otherdomain.com
- You are instructing postfix to receive mails for the domainsmydomain.com
andotherdomain.com
, whose valid recipients can be specified usinglocal_recipient_maps
and postfix considers the domains listed undermydestination
as local address class. More about address classes here. I personally prefervirtual mailbox domain class
for enablingPOP3/IMAP
.There is no magic with
/etc/mailname
and instead of specifying in this formmyorigin = mydomain.com
, you also have the flexibility to specify it asmyorigin = /etc/mailname
with the content of/etc/mailname
asmydomain.com
local mail delivery:
The default per-user mailbox is a file in the UNIX mail spool directory (
/var/mail/user
or/var/spool/mail/user
); the location can be specified with themail_spool_directory
configuration parameter. Alternatively, the per-user mailbox can be a file in the user's home directory with a name specified via thehome_mailbox
configuration parameter.So postfix will deliver the mail to mail spool directory or in user's home directory as per your settings. The job of an
SMTP
server is done. Exposing your mails throughPOP3/IMAP
will requirePOP3/IMAP
server likedovecot
and you should configure yourPOP3/IMAP
server as where it should find the mails for exposing it usingPOP3/IMAP
.Hope that helps.