[SOLVED] Sieve Filtering?

killmasta93

Renowned Member
Aug 13, 2017
973
58
68
31
Hi i was wondering if someone could shed some light on the issue im having

currently redirecting all spam emails to the user and then using the sieve filter to go to the spam folder of the user

i checked the headers of a SPAM email which give out PMG, which shows the spam level
Code:
From: "test" <test@gmail.com>
X-Priority: 3 (Normal)
Importance: Normal
Errors-To: test@gmail.com
Reply-To: test@gmail.com
Content-Type: text/plain; charset=utf-8
Message-Id: <20210625190508.C0BE624120@emkei.cz>
Date: Fri, 25 Jun 2021 21:05:08 +0200 (CEST)
X-SPAM-LEVEL: Spam detection results:  5
   DKIM_ADSP_CUSTOM_MED    0.001 No valid author signature, adsp_override is CUSTOM_MED
   FORGED_GMAIL_RCVD           1 'From' gmail.com does not match 'Received' headers
   FREEMAIL_FROM           0.001 Sender email is commonly abused enduser mail provider
   NML_ADSP_CUSTOM_MED       1.2 ADSP custom_med hit, and not from a mailing list
   SPF_HELO_PASS          -0.001 SPF: HELO matches SPF record
   SPF_SOFTFAIL            0.972 SPF: sender does not match SPF record (softfail)
   SPOOFED_FREEMAIL        1.496 -
   SPOOF_GMAIL_MID          0.43 From Gmail but it doesn't seem to be...

dfgdfg

on my postfix server i have this filter which means 5 and above move that email to junk folder
but seems to not work, Im not sure if the if header i have it correctly normally most tutorials shows if header contains SPAM YES
So not sure if thats possible to change on PMG or maybe im missing something on the filtering?


Code:
require ["fileinto", "reject", "tag", "flag", "editheader"];

#Filter email based on spam level
require ["fileinto", "mailbox"];
if header :contains "X-Spam-Level" "*****"
{
    fileinto :create "Junk";
}

Thank you
 
Last edited:
Shouldn't be the if clause

Code:
if header :contains "X-Spam-Level" ["*****"]

Dunno if the square brackets are playing the game, but worth to try it.
Another advice that might help is to check/edit your require line. I'm using

Code:
require ["fileinto","regex","envelope","vacation"];

for some if header :regex :comparator and if header :contains clauses for years and these are working fine.
 
  • Like
Reactions: killmasta93
Thanks for the reply what i did was to create a header rule to add tag spam to YES and filter it with YES and got it working thank you again
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!