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 username@ejemplo.org.

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

Example that pepe has as pepe1@ejemplo.org as mail account.

All who receive mail from pepe have as sender pepe1@ejemplo.org.

And that all mail sent to pepe1@ejemplo.org receive pepe.

I have the following:

In /etc/postfix/main.cf 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


pepe1@ejemplo.org pepe@ejemplo.org
pepe2@ejemplo.org        pepe@ejemplo.org


pepe@ejemplo.org pepe1@ejemplo.org
pepe    pepe1

Also run the following lines:

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

If sending an email to pepe1@ejemplo.org get what I want, pepe@ejemplo.org can read the mail.

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

Any help?, Thanks for help.

  • 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

pepe1@ejemplo.org username@ejemplo.org


In /etc/postfix/header_checks:

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

3) Run:

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

4) In /etc/postfix/main.cf 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 username@ejemplo.org will use as the sender pepe1@ejemplo.org And mail sent to pepe1@ejemplo.org them will be sent to username@ejemplo.org.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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