mirror of
				https://github.com/optim-enterprises-bv/Mailu.git
				synced 2025-11-03 19:47:52 +00:00 
			
		
		
		
	Attempt stripping recipient delimiter from localpart
Since postfix now asks us for the complete email over podop, which includes the recipient-delimiter-and-what-follows not stripped, we need to attempt to find both the verbatim localpart, as well as the localpart stripped of the delimited part …. Fixes #755
This commit is contained in:
		@@ -260,10 +260,19 @@ class Email(object):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @classmethod
 | 
					    @classmethod
 | 
				
			||||||
    def resolve_destination(cls, localpart, domain_name, ignore_forward_keep=False):
 | 
					    def resolve_destination(cls, localpart, domain_name, ignore_forward_keep=False):
 | 
				
			||||||
 | 
					        localpart_stripped = 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)
 | 
					        alias = Alias.resolve(localpart, domain_name)
 | 
				
			||||||
 | 
					        if not alias and localpart_stripped:
 | 
				
			||||||
 | 
					            alias = Alias.resolve(localpart_stripped, domain_name)
 | 
				
			||||||
        if alias:
 | 
					        if alias:
 | 
				
			||||||
            return alias.destination
 | 
					            return alias.destination
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        user = User.query.get('{}@{}'.format(localpart, domain_name))
 | 
					        user = User.query.get('{}@{}'.format(localpart, domain_name))
 | 
				
			||||||
 | 
					        if not user and localpart_stripped:
 | 
				
			||||||
 | 
					            user = User.query.get('{}@{}'.format(localpart_stripped, domain_name))
 | 
				
			||||||
        if user:
 | 
					        if user:
 | 
				
			||||||
            if user.forward_enabled:
 | 
					            if user.forward_enabled:
 | 
				
			||||||
                destination = user.forward_destination
 | 
					                destination = user.forward_destination
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user