jlinos wrote:
1. Someone with email
user1@domain.com sends email to
client@other.com. I want to know if there is a way in postfix to change
user1@domain.com email address in
user2@domain.com at sending time?
Yes, there is a way. What you need to do is create a sender canonical map which maps raw addresses onto rewritten addresses. I use one for local accounts on my mail server which contains the following:
Code:
@dorothy.movealong.org @movealong.org
MUAs on my server will produce email with the FQDN of the server as the sender domain, which I rewrite to just the domain. The canonical map can map whole domains, like I do, or specific addresses. In your case, the map you need will look like this:
Code:
user1@domain.com user2@domain.com
Once you have created the map, you can refer to it in your main.cf with this:
Code:
sender_canonical_maps = hash:/etc/postfix/<your map name>
jlinos wrote:
2. I have a virtual email address
media@domain.com that expands to a lot of clients' email addresses, and when a user
user1@domain.com sends email to this address it goes to all his clients. Now if he sets To: to
media@domain.com the clients can see that and if one of the clients sends email to
media@domain.com then all the clients will receive that email, and that must not happen. So the question is: how can i forbidd in postfix that only
user1@domain.com can send email to
media@domain.com and no other. Right now I have a workaround and he sends email with To: to a bogus email address and Bcc: to
media@domain.com, but I would like to know if there is also another way to do it.
Postfix also has recipient canonical maps, which will do the same thing as sender canonical maps except on the recipient address instead of the sender. I don't know if this will solve your problem, though, because I think after the address is rewritten the message is delivered to the new address and not the old. You may want to play around with this, though and see what you can get.
If there's no way to do this in Postfix, you could try setting up
media@domain.com as a proper mailing list, for example using Mailman. I know that Mailman allows very fine-grained control over who is allowed to post messages to the list and who is not. I expect pretty much any mailing list manager would support that feature.
Good luck!