mirror of
https://github.com/Mailu/Mailu.git
synced 2024-12-14 10:53:30 +02:00
Deliver mails to alias-stripped-of-delimeter, even if catchall exists
This fixes delivery to an alias minus recipient delimiter in cases where a wildcard alias would also match. For example, * foo@xxx.tld * %@xxx.tld Sending to foo+spam@xxx.tld would get eaten by the catchall before this fix. Now, the order of alias resolution is made clearer. closes #813
This commit is contained in:
parent
4204facd85
commit
291f8a457b
@ -111,6 +111,7 @@ v1.6.0 - unreleased
|
||||
- Bug: Fix rainloop permissions ([#637](https://github.com/Mailu/Mailu/issues/637))
|
||||
- Bug: Fix broken webmail and logo url in admin ([#792](https://github.com/Mailu/Mailu/issues/792))
|
||||
- Bug: Don't recursivly chown on mailboxes ([#776](https://github.com/Mailu/Mailu/issues/776))
|
||||
- Bug: Don't deliver alias and recipient-delimiter to overwhelming wildcard-alias ([#813](https://github.com/Mailu/Mailu/issues/813))
|
||||
|
||||
v1.5.1 - 2017-11-21
|
||||
-------------------
|
||||
|
@ -261,14 +261,23 @@ class Email(object):
|
||||
@classmethod
|
||||
def resolve_destination(cls, localpart, domain_name, ignore_forward_keep=False):
|
||||
localpart_stripped = None
|
||||
stripped_alias = None
|
||||
|
||||
if os.environ.get('RECIPIENT_DELIMITER') in localpart:
|
||||
localpart_stripped = localpart.rsplit(os.environ.get('RECIPIENT_DELIMITER'), 1)[0]
|
||||
|
||||
alias = Alias.resolve(localpart, domain_name)
|
||||
if not alias and localpart_stripped:
|
||||
alias = Alias.resolve(localpart_stripped, domain_name)
|
||||
if alias:
|
||||
return alias.destination
|
||||
pure_alias = Alias.resolve(localpart, domain_name)
|
||||
has_wildcard = pure_alias and '%' in pure_alias.email and pure_alias.wildcard
|
||||
stripped_alias = Alias.resolve(localpart_stripped, domain_name)
|
||||
|
||||
if pure_alias and not has_wildcard:
|
||||
return pure_alias.destination
|
||||
elif not pure_alias and stripped_alias:
|
||||
return stripped_alias.destination
|
||||
elif has_wildcard and localpart_stripped and stripped_alias:
|
||||
return stripped_alias.destination
|
||||
elif pure_alias:
|
||||
return pure_alias.destination
|
||||
|
||||
user = User.query.get('{}@{}'.format(localpart, domain_name))
|
||||
if not user and localpart_stripped:
|
||||
|
Loading…
Reference in New Issue
Block a user