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

I'm using Postfix with Cyrus Imap.

The login is done by authenticating with GSS-API (SSO).

The format of mail accounts for all users is

For a few users want your mail account follow another format.

Example that pepe has as as mail account.

All who receive mail from pepe have as sender

And that all mail sent to receive pepe.

I have the following:

In /etc/postfix/ add

virtual_alias_maps = hash:/etc/postfix/virtual
canonical_maps = hash:/etc/postfix/canonical
sender_canonical_maps = hash:/etc/postfix/canonical
recipient_canonical_maps = hash:/etc/postfix/canonical


pepe    pepe1

Also run the following lines:

postmap /etc/postfix/virtual
postmap /etc/postfix/canonical

If sending an email to get what I want, can read the mail.

But if I send an email from you receive the mail from and NO pepe1 as I want it to display.

Any help?, Thanks for help.

share|improve this question
This solved. In a few minutes I publish my solution. – Maria José Oct 15 '13 at 18:35

Answer over here instead of a comment to make it clearer.


In nano /etc/postfix/virtual


In /etc/postfix/header_checks:

/^From:.*username@ejemplo\.org/ REPLACE

3) Run:

postmap /etc/postfix/virtual
postmap /etc/postfix/sender_canonical

4) In /etc/postfix/ add:

virtual_alias_maps = hash:/etc/postfix/virtual
header_checks = regexp:/etc/postfix/header_checks

5) postfix restart:

 postfix stop
 postfix start

The mail sent by will use as the sender And mail sent to them will be sent to

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.