Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

/etc/postfix/virtual

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

/etc/postfix/canonical

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.

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

1 Answer 1

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

1)

In nano /etc/postfix/virtual

pepe1@ejemplo.org username@ejemplo.org

2)

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.

share|improve this answer

Your Answer

 
discard

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.