Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have been having some trouble getting Postfix to behave in a very specific fashion in which sender and recipient addresses with only a localpart (i.e. no @domain) are handled differently.

We have a number of applications that use mailx to send messages. We would like to know the username and hostname of the sending party. For example, if root sends an email from, we would like the email to be addressed from This is accomplished by ensuring $myorigin is set to $myhostname.

We also want unqualified recipients to have a different domain appended. For example, if a message is sent to 'dbadmin' it should qualify to ''. However, by the nature of Postfix and $myorigin, an unqualified recipient would instead qualify to We do not want to adjust the aliases on all servers to forward appropriately. (in fact, every possible recipient doesn't have an entry in /etc/passwd) All company employees have mailboxes on Exchange, which Postfix eventually routes to, and no local Linux/Unix mailboxes are used or access. We would love to tell our application owners to ensure they use a fully qualified email address for all recipients, but the powers that be dictate that any negligence must be accommodated.

If we were to keep $myorigin equal to $myhostname, we could resolve this issue by having an entry such as the following in 'recipient_canonical_maps':


However, unfortunately, we cannot use variables in these map files. We also want to avoid having to manually enter and maintain the actual hostname in 'recipient_canonical_maps' for each server. Perhaps once our servers are 'puppetized' we can dynamically adjust this file, but we're not there yet.

After an afternoon of fiddling I've decided to reach out. Any thoughts? Thanks in advance.

share|improve this question

This is not possible.

As documented, postfix appends the value of myorigin to all non-fqdn localparts, anywhere in the mail system, if append_at_myorigin is set.

A solution may be available if every address uses a different localpart; in that case, you can use virtual_alias_maps to translate localparts to a given fully-qualified address.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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