Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Släpp (DISCARD) meddelanden 'från' spexadresser som inte lagts in som… #55

Merged
merged 4 commits into from
Jun 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lissmilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,14 @@ def envrcpt(self, mail_to, *str):
# Should only happen if no AssociationGroup called 'STYR' has been created yet
pass

# Check if sender is valid before discarding any emails. A user sending 'from' the current domain, to an internal list, should add this as an extra email in the database.
if not valid_sender:
self.setreply('554', '5.7.2', 'Sender <{}> not authorized for recipient ("{}"). Kontakta en ansvarig om du tycker det borde funka.'.format(self.envelope_from, to))
return Milter.REJECT
if f'@{mail_domain}' in self.envelope_from:
anargam marked this conversation as resolved.
Show resolved Hide resolved
# https://pymilter.org/pymilter/namespacemilter.html#a4c8bad190cb7f54cea87f1182732ce83
return Milter.DISCARD
else:
self.setreply('554', '5.7.2', 'Sender <{}> not authorized for recipient ("{}"). Kontakta en ansvarig om du tycker det borde funka.'.format(self.envelope_from, to))
return Milter.REJECT

self.change_subject = is_production_list or is_mass_list or is_summons_list

Expand Down