diff --git a/interface/web/mail/mail_user_del.php b/interface/web/mail/mail_user_del.php
index dc92047331952f097b8e80327102c71ca8a036d0..1f19166ef7c64de361b0bdf0a91d69ddd8403974 100644
--- a/interface/web/mail/mail_user_del.php
+++ b/interface/web/mail/mail_user_del.php
@@ -55,6 +55,14 @@ class page_action extends tform_actions {
 		global $app; $conf;
 
 		$tmp_user = $app->db->queryOneRecord("SELECT id FROM spamfilter_users WHERE email = ?", $this->dataRecord["email"]);
+		if (is_array($tmp_user) && isset($tmp_user['id'])) {
+			$tmp_wblists = $app->db->queryAllRecords("SELECT wblist_id FROM spamfilter_wblist WHERE rid = ?", $tmp_user['id']);
+			if(is_array($tmp_wblists)) {
+				foreach($tmp_wblists as $tmp) {
+					$app->db->datalogDelete('spamfilter_wblist', 'wblist_id', $tmp['wblist_id']);
+				}
+			}
+		}
 		$app->db->datalogDelete('spamfilter_users', 'id', $tmp_user["id"]);
 
 		$tmp_filters = $app->db->queryAllRecords("SELECT filter_id FROM mail_user_filter WHERE mailuser_id = ?", $this->id);
@@ -71,4 +79,3 @@ class page_action extends tform_actions {
 $page = new page_action;
 $page->onDelete();
 
-?>
diff --git a/interface/web/mail/spamfilter_users_del.php b/interface/web/mail/spamfilter_users_del.php
index 0dc92935c136a0e00c3e24afad521848407cf8d8..a243803f9fc3577b2811556c292945957bde0d3e 100644
--- a/interface/web/mail/spamfilter_users_del.php
+++ b/interface/web/mail/spamfilter_users_del.php
@@ -45,7 +45,24 @@ require_once '../../lib/app.inc.php';
 //* Check permissions for module
 $app->auth->check_module_permissions('mail');
 
-$app->uses("tform_actions");
-$app->tform_actions->onDelete();
+$app->uses('tform_actions');
+$app->load('tform_actions');
+
+class page_action extends tform_actions {
+
+        function onBeforeDelete() {
+                global $app; $conf;
+
+		$tmp_wblists = $app->db->queryAllRecords("SELECT wblist_id FROM spamfilter_wblist WHERE rid = ?", $this->id);
+		if(is_array($tmp_wblists)) {
+			foreach($tmp_wblists as $tmp) {
+				$app->db->datalogDelete('spamfilter_wblist', 'wblist_id', $tmp['wblist_id']);
+			}
+		}
+        }
+
+}
+
+$page = new page_action;
+$page->onDelete();
 
-?>