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

  • 1
    I'm not really sure if it's a duplicate or not, but based on your "I would like to understand the whole picture of local mail/hostname/mailname", I would suggest having a look at Why don't mails show up in the recipient's mailspool?. – a CVn Oct 25 '14 at 14:44
  • @MichaelKjörling I will take it a look. – Peregring-lk Oct 25 '14 at 15:07
  • If it turns out to answer your question, you may want to vote to close this question as a duplicate of that one. – a CVn Oct 25 '14 at 15:13
  • myorigin = mydomain.com - The domain name to append when the UNIX user sends out a mail. (For eg. If UNIX user john sends mail, then john@mydomain.com will be the sender address. If you want your sending domain to be mail.domain.com set your myorigin accordingly.
  • myhostname = mail.mydomain.com - The unique FQDN of your mail server. When talking to other SMTP servers, it identifies itself as mail.mydomain.com. There is no necessity that your system name should match the myhostname 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 domains mydomain.com and otherdomain.com, whose valid recipients can be specified using local_recipient_maps and postfix considers the domains listed under mydestination as local address class. More about address classes here. I personally prefer virtual mailbox domain class for enabling POP3/IMAP.

There is no magic with /etc/mailname and instead of specifying in this form myorigin = mydomain.com, you also have the flexibility to specify it as myorigin = /etc/mailname with the content of /etc/mailname as mydomain.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 the mail_spool_directory configuration parameter. Alternatively, the per-user mailbox can be a file in the user's home directory with a name specified via the home_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 through POP3/IMAP will require POP3/IMAP server like dovecot and you should configure your POP3/IMAP server as where it should find the mails for exposing it using POP3/IMAP.

Hope that helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.