Added on Jun 25th, 2012 and marked as config mail postfix server

The Postfix settings are stored in /etc/postfix/main.cf and /etc/postfix/master.cf.

With the following commands you can check the setting of a specific parameter:

postconf | grep <parameter>     # The actual setting of the parameter
postconf -d | grep <parameter>  # The default setting of the parameter
postconf -n | grep <parameter>  # The value of the parameter set in main.cf/master.cf

The domain to use in outbound mail

myorigin: Domain that appears in the outbound mail. By default this is set to $myhostname (the machine name). Set it to $mydomain to specify the parent domain of the machine name.

Use myorigin = /etc/mailname to use the name that was set in /etc/mailname.

What domains to receive mail for

The mydestination parameter specifies what domains this machine will deliver locally, instead of forwarding to another machine. The default is to receive mail for the machine itself.

You can specify zero or more domain names, /file/name patterns and/or type:table lookup tables, separated by whitespace and/or commas.

If the machine is a mail server for its entire domain, you must list $mydomain as well.

Example 1: default setting

mydestination = $myhostname localhost.$mydomain localhost

Example 2: domain-wide mail server

mydestination = $myhostname localhost.$mydomain localhost $mydomain

Example 3: host with multiple DNS A records

mydestination = $myhostname localhost.$mydomain localhost www.$mydomain ftp.$mydomain

In order to avoid mail delivery loops, you must list all hostnames of the machine, including $myhostname, and localhost.$mydomain.

What destinations to relay mail to

By default, Postfix will forward mail from strangers (clients outside authorized networks) to authorized remote destinations only. Authorized remote destinations are defined with the relay_domains configuration parameter. The default is to authorize all domains (and subdomains) of the domains listed with the mydestination parameter.

Examples (specify only one of the following):

relay_domains = $mydestination (default)
relay_domains =                (safe: never forward mail from strangers)
relay_domains = $mydomain      (forward mail to my domain and subdomains)

Checks

Check if Postfix accepts mail for a specific domain:

postmap -q example.com mysql:/etc/postfix/mysql-virtual_domains.cf

This should return the domain (or whatever you specified in the MySQL query in /etc/postfix/mysql-virtual_domains.cf). If you get an empty line, this means mail for the domain is not accepted (relay access denied).

Check if the mail for a specific address is saved in the correct directory:

postmap -q [email protected]com mysql:/etc/postfix/mysql-virtual_mailboxes.cf

This should return example.com/info/ or just an empty line if the address is not mapped to a directory.

Background information