[pmg-devel] [PATCH] fix #2228: automatically deliver/delete on whitelist/blacklist

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Mar 30 17:05:47 CEST 2021

If a user chooses to blacklist a specific sender of a mail, the mail
is highly probably undesired too, so delete it in that case.

The reverse should hold for white listing a mail's sender, deliver it
in that case.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>

The bug report talked about doing this opt-out, but I really do not see when
one would think along the lines of "that sender is always spam, blacklist them
but keep that specific mail" so just do it unconditionally.

 src/PMG/API2/Quarantine.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/PMG/API2/Quarantine.pm b/src/PMG/API2/Quarantine.pm
index 848ae8e..2fa1bb4 100644
--- a/src/PMG/API2/Quarantine.pm
+++ b/src/PMG/API2/Quarantine.pm
@@ -1228,8 +1228,10 @@ __PACKAGE__->register_method ({
 	    if ($action eq 'whitelist') {
 		PMG::Quarantine::add_to_blackwhite($dbh, $ref->{pmail}, 'WL', [ $sender ]);
+		PMG::Quarantine::deliver_quarantined_mail($dbh, $ref, $ref->{receiver} // $ref->{pmail});
 	    } elsif ($action eq 'blacklist') {
 		PMG::Quarantine::add_to_blackwhite($dbh, $ref->{pmail}, 'BL', [ $sender ]);
+		PMG::Quarantine::delete_quarantined_mail($dbh, $ref);
 	    } elsif ($action eq 'deliver') {
 		PMG::Quarantine::deliver_quarantined_mail($dbh, $ref, $ref->{receiver} // $ref->{pmail});
 	    } elsif ($action eq 'delete') {

More information about the pmg-devel mailing list