1299: Don't remove the address extension in postfix r=mergify[bot] a=RobertMe

## What type of PR?
Bugfix

## What does this PR do?
Currently when the mail address is looked up by Postfix (using the admin
part) the address extension is removed. This is due to the address
extension being removed to look up the user, and afterwards returning
the users mail address. But by not returning the mail address including
the address extension it also isn't part anymore in the LMTP
communication to Dovecot. So Dovecot doesn't know about the extension,
and in turn the address extension can't be used in Sieve mail filtering.

This change fixes that by returning the original address by just
concatinating the "localpart" and domain again when the user is found.

### Related issue(s)
Fixes #982

## Prerequistes
Before we can consider review and merge, please make sure the following list is done and checked.
If an entry in not applicable, you can check it or remove it from the list.

- [ ] In case of feature or enhancement: documentation updated accordingly
- [ ] Unless it's docs or a minor change: add [changelog](https://mailu.io/master/contributors/guide.html#changelog) entry file.


Co-authored-by: Robert Meijers <robert.meijers@gmail.com>
master
bors[bot] 5 years ago committed by GitHub
commit 812439332a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -277,12 +277,14 @@ class Email(object):
if not user and localpart_stripped: if not user and localpart_stripped:
user = User.query.get('{}@{}'.format(localpart_stripped, domain_name)) user = User.query.get('{}@{}'.format(localpart_stripped, domain_name))
if user: if user:
email = '{}@{}'.format(localpart, domain_name)
if user.forward_enabled: if user.forward_enabled:
destination = user.forward_destination destination = user.forward_destination
if user.forward_keep or ignore_forward_keep: if user.forward_keep or ignore_forward_keep:
destination.append(user.email) destination.append(email)
else: else:
destination = [user.email] destination = [email]
return destination return destination
pure_alias = Alias.resolve(localpart, domain_name) pure_alias = Alias.resolve(localpart, domain_name)

Loading…
Cancel
Save