How to set the hostname of a postfix mail server?

In a VPS with Ubuntu 12.04 LTS, I have installed postfix. The domain name is example.com, the VPS hostname is server.example.com. For the domain example.com I create an MX record. After that a mail server mail.example.com is up and running.

How to in postfix configuration main.cf set myhostname?

myhostname=server.example.com

OR

myhostname=mail.example.com

The hostname is really the name of your VPS host. The name in your MX record goes into mydomain.

myhostname=server.example.com
mydomain=mail.example.com # if you receive emails as [email protected], or mydomain=example.com if you receive emails as [email protected]