Delay and Delays in Postfix

Feb 8 12:46:24 relayserver postfix/smtp[21315]: 2vJLYX0Wghz7f3t: to=, relay=[]:25, delay=0.09, delays=0.01/0/0.04/0.05, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 200698166A)

If we take a look at the example email from above:

The delay parameter (delay=0.09) is fairly self explanatory, it is the total amount of time this email (2vJLYX0Wghz7f3t) has been on this server.
But what is the delays parameter all about?


NOTE: Numbers smaller than 0.01 seconds are truncated to 0, to reduce the noise level in the logfile.

You might have guessed it is a break down of the total delay, but what do each number represent?

a=time before queue manager, including message transmission;
b=time in queue manager;
c=connection setup time including DNS, HELO and TLS;
d=message transmission time.

More explanation:

a (0.01): The time before getting to the queue manager, so the time it took to be transmitted onto the mail server and into postfix.
b (0): The time in queue manager, so this email didn’t hit the queues, so it was emailed straight away.
c (0.04): The time it took to set up a connection with the destination mail relay.
d (0.05): The time it took to transmit the email to the destination mail relay.

More information can be found here:

Forward outgoing mails of particular user to another account using sender_bbc_maps in Postfix

To forward outgoing mails of particular user to another account using sender_bbc_maps in Postfix:

To add the following entry:

sender_bcc_maps = hash:/etc/postfix/sender_bcc

and then create a file in /etc/postfix called: sender_bcc and then add the following entry to sender_bcc:

And then type the following command:

postmap /etc/postfix/sender_bcc

and restart Postfix. Now on, emails sent from will be a blind carbon copy to

Postfix restriction classes.

Postfix’ built-in restriction classes are processed in the following order:


regardless of the order in which they’re listed in Restrictions (within a restriction class) are evaluated in the order in which they’re listed.
Processing within a restriction class ends on the first match.

Useful link:

Change the default Postfix queue ID to a long format.

The benefit of non-repeating names (queue ID) is simpler logfile analysis and easier queue migration. And there is nothing wrong with the default settings 😉

New queue files are created with names such as 3Pt2mN2VXxznjll. These are encoded in a 52-character alphabet that contains digits (0-9), upper-case letters (B-Z) and lower-case letters (b-z). For safety reasons the vowels (AEIOUaeiou) are excluded from the alphabet. The name format is: 6 or more characters for the time in seconds, 4 characters for the time in microseconds, the ‘z’; the remainder is the file inode number encoded in the first 51 characters of the 52-character alphabet.

How this looks now:

Jul 12 17:34:17 bnmrelay postfix/pickup[20475]: DA41A139183: uid=0 from=
Jul 12 17:34:17 bnmrelay postfix/cleanup[21313]: DA41A139183: message-id=<>
Jul 12 17:34:17 bnmrelay postfix/qmgr[30234]: DA41A139183: from=<>, size=463, nrcpt=1 (queue active)
Jul 12 17:34:18 bnmrelay postfix/smtp[21302]: DA41A139183: to=<>, relay=[]:25, delay=0.28, delays=0.05/0/0/0.23, dsn=2.6.0, status=sent (250 2.6.0 <> [InternalId=44586055500327,] Queued mail for delivery)
Jul 12 17:34:18 bnmrelay postfix/qmgr[30234]: DA41A139183: removed

And after the change:

Jul 12 17:34:17 bnmrelay postfix/pickup[20475]: 3rpnHt4Sgnz21N4: uid=0 from=
Jul 12 17:34:17 bnmrelay postfix/cleanup[21313]: 3rpnHt4Sgnz21N4: message-id=<>
Jul 12 17:34:17 bnmrelay postfix/qmgr[30234]: 3rpnHt4Sgnz21N4: from=<>, size=463, nrcpt=1 (queue active)
Jul 12 17:34:18 bnmrelay postfix/smtp[21302]: 3rpnHt4Sgnz21N4: to=<>, relay=[]:25, delay=0.28, delays=0.05/0/0/0.23, dsn=2.6.0, status=sent (250 2.6.0 <> [InternalId=44586055500327,] Queued mail for delivery)
Jul 12 17:34:18 bnmrelay postfix/qmgr[30234]: 3rpnHt4Sgnz21N4: removed

Proxy_interface – Postfix

proxy_interfaces (default: empty)

The network interface addresses that this mail system receives mail on by way of a proxy or network address translation unit. This feature is available in Postfix 2.0 and later.
You must specify your “outside” proxy/NAT addresses when your system is a backup MX host for other domains, otherwise mail delivery loops will happen when the primary MX host is down.


proxy_interfaces =

If you miss this step, you’ll see messages like this in your log file:

Apr 8 20:10:14 hades postfix/smtp[1908]: 08CABB59: to=,[]:25, delay=1.4, delays=0.39/0.01/0.99/0, dsn=4.4.6, status=deferred (mail for loops back to myself)

generic – Postfix generic table format

It has been taken from man – an interface to the on-line reference manuals.

The following shows a generic mapping with an indexed file. When mail
is sent to a remote host via SMTP, this replaces his@localdomain.local
by his ISP mail address, replaces her@localdomain.local by her ISP mail
address, and replaces other local addresses by his ISP account, with an
address extension of +local (this example assumes that the ISP supports
“+” style address extensions).

smtp_generic_maps = hash:/etc/postfix/generic

his@localdomain.local hisaccount@hisisp.example
her@localdomain.local heraccount@herisp.example
@localdomain.local hisaccount+local@hisisp.example

Execute the command “postmap /etc/postfix/generic” whenever the table
is changed. Instead of hash, some systems use dbm database files. To
find out what tables your system supports use the command “postconf -m”.
Continue reading “generic – Postfix generic table format”

Address masquerading in Postfix.

Address masquerading refers to the idea that you can hide the names of internal hosts, and make all addresses appear as if they originated from the gateway system itself. You may have internal systems that use your Postfix server as a gateway. When mail is sent from these systems and the sender addresses include the fully qualified hostname, you may want addresses to appear with the domain name only. The masquerade_domains parameter strips hostnames down to their simpler domain names.

The parameter takes a list of domains. Any address whose fully qualified hostname matches the domain portion is stripped down to just the domain name:

root# vim /etc/postfix/

masquerade_domains =

Addresses that look like and are converted to and

You can list multiple domains and subdomains. Postfix processes addresses against masquerade domain names in the order you list them. Consider a network that includes the two subdomains, and You want addresses from these domains to show the subdomain, but you want addresses from any other domain or host in the network to show the parent domain. Set masquerade_domains as follows:

masquerade_domains =

With this setting, the address matches, so that it becomes
The address matches, and becomes Finally, matches the last value,, to become

If you want to preserve a domain name that would otherwise be stripped down, you can preface the domain with an exclamation point:

masquerade_domains = !,

In this case, the domain will not be rewritten, so the address stays as it is.

You can exclude specific account names from masquerading. For example, if you want an address like to stay intact, add the account to the masquerade_exceptions parameter:

masquerade_exceptions = admin, root

And then:

root# /etc/init.d/./postfix restart

Rewriting Addresses – Postfix canonical maps.

Postfix canonical maps can be defined in 3 ways.

1. canonical_maps – rewrites the sender and recipient address
2. sender_canonical_maps – rewrites the sender address
3. recipient_canonical_maps – rewrites the recipient address

In, point the canonical_maps parameter to the canonical file and then add addresses that you would like to rewrite.
For Example:

root# vim /etc/postfix/
# Add the following to your configuration file.
canonical_maps = hash:/etc/postfix/canonical

root# vim /etc/postfix/canonical
# address that would like to rewrite new address
user1 greg

root# postmap canonical && postfix reload