17

For #myhostname, I should uncomment and put my hostname, i.e. the name I gave my VPS, right? Or does it just go myhostname = mydomain.net, in other words don't edit the phrase 'myhostname' except to uncomment?

And for #myhostname = virtual.domian.tld is that to put a subdomain?

Should I add a listing for all including with and without www?

1 Answer 1

23

The myhostname should be set to the FQDN of your mail server. For example, if your server's hostname is "mail" and your domain is "example.com", your FQDN is "mail.example.com". The directive would look like this:

myhostname = mail.example.com

On a Linux system, you can get your FQDN using the hostname command:

hostname --fqdn

This should match the PTR record for the primary IP on the machine.

See the Postfix documentation for myhostname.

For accepting mail for subdomains which are not the server's hostname, you can use the mydestination directive:

mydestination = mail.example.com, example.com, www.example.com
4
  • What would happen if myhostname is the same as mydomain? Commented Jan 29, 2016 at 22:14
  • @Braiam then you have failed to assign your server an actual hostname. Using what you assigned may still work however. Commented Jan 29, 2016 at 22:36
  • 2
    And what if you are not using this to receive mail and only using postfix to send email out from the server? Eg. I have a server hosting website mydomain.com but mail for mydomain.com is hosting a totally different place... Commented Feb 22, 2018 at 21:16
  • What about virtual machines running inside a physical machine with a real FQDN hostname? Should you put just the hostname of the virtual machine without domain, the physical machine name or something else here? Obviously this kind of virtual machines always use relay servers so this is mostly about what is saved in Received headers. Commented Mar 4 at 12:33

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.