mailcow / mailcow-dockerized

mailcow: dockerized - 🐮 + 🐋 = 💕
https://mailcow.email
GNU General Public License v3.0
8.7k stars 1.17k forks source link

Support for flexible identities for a mailbox for sending and receiving #5665

Open svargh opened 8 months ago

svargh commented 8 months ago

Summary

I want to migrate our old postfix system. Users can have multiple flexible permanent identities both for sending and receiving.

It would be nice, if this is natively supported in mailcow:

How I tried to solve it with current Mailcow (2024-01a):

Current state, how I solved it: 1) These identities are defined here and not overlapping: cat /opt/mailcow-dockerized/data/conf/postfix/virtual-regexp /^ua[-.[:alnum:]]*@example.com/ user01@example.com /^ub[-.[:alnum:]]@example.com/ user02@example.com /^bla[-_.[:alnum:]]@example.com/ user02@example.com

Example: Receive (SPAM) email and also reply for these identity <-> mailbox mappings : blablasdacsa@example.com - user02@example.com ubonlineshopxxx@example.com - user02@example.com If user01 tries to send mail as blablasdacsa@example.com or ubonlineshopxxx@example.com, he will get error ("Sender address rejected: not owned by user ")

2) Add in extras.cf using stuff from main.cf virtual_alias_maps = regexp:/opt/postfix/conf/virtual-regexp, proxy:mysql:/opt/postfix/conf/sql/mysql_virtual_alias_maps.cf, proxy:mysql:/opt/postfix/conf/sql/mysql_virtual_resource_maps.cf, proxy:mysql:/opt/postfix/conf/sql/mysql_virtual_spamalias_maps.cf, proxy:mysql:/opt/postfix/conf/sql/mysql_virtual_alias_domain_maps.cf, regexp:/opt/postfix/conf/virtual-regexp smtpd_sender_login_maps = regexp:/opt/postfix/conf/virtual-regexp,proxy:mysql:/opt/postfix/conf/sql/mysql_virtual_sender_acl.cf

Test, that regexp works and not overalapping: docker exec -it -u root mailcowdockerized-postfix-mailcow-1 bash postmap -q "blasd@example.com" regexp:/opt/postfix/conf/virtual-regexp user02@example.com

Motivation

Because the mailbox is loosely coupled to one or more identities for sending and receiving:

Additional context

No response

fritzw commented 7 months ago

Could you not simply add an alias (or another mailbox + forwarding) for each user, called ua, ub, or bla? Of course you would have to assign them rights to send under that name in the mailcow UI, just as you assign them regexes now. Then they could send mail as ub+onlineshopxxx@example.com etc. Not exactly the same, but still hiding their real name.

svargh commented 7 months ago

Could you not simply add an alias (or another mailbox + forwarding) for each user, called ua, ub, or bla? Of course you would have to assign them rights to send under that name in the mailcow UI, just as you assign them regexes now. Then they could send mail as ub+onlineshopxxx@example.com etc. Not exactly the same, but still hiding their real name.

Sounds good! Is it possible to do this without the + symbol or using the dot?

fritzw commented 7 months ago

Well, the + is called recipient_delimiter and you could configure it to something else if you really want (see #1146), but that's not supported and I don't think it can be empty as in the examples in your first post.