Mail Body Filtering and SPF Alignments

May 14, 2020
17
1
6
33
I want to filter a specific content for the inbound emails, how could we add it in the "What objects"?
Also I want to Quarantine emails is not SPF Alignment, SPF Authenticated and DKIM Alignment Emails ?
 
Try this. Btw, custom scores is to adjust spamassassin default rule score.

body LOCAL_RULE /7amada/i
 
Last edited:
run systemctl restart pmg-smtp-filter in terminal to restart the service.
 
It work for me. This is my /etc/pmg/spamassassin/custom.cf and test email from gmail.

1663030680174.png

Code:
Return-path: <user1@gmail.com>
Received: from pmg.mydomain.com ([192.168.40.106])
    by mail.mydomain.com with ESMTP; Tue, 13 Sep 2022 08:54:48 +0800
Received: from pmg.mydomain.com (localhost.localdomain [127.0.0.1])
    by pmg.mydomain.com (Proxmox) with ESMTP id E23E140B35
    for <user1@mydomain.com>; Tue, 13 Sep 2022 08:54:48 +0800 (+08)
Received-SPF: pass (gmail.com ... _spf.google.com: Sender is authorized to use 'user1@gmail.com' in 'mfrom' identity (mechanism 'include:_netblocks.google.com' matched)) receiver=pmg.mydomain.com; identity=mailfrom; envelope-from="user1@gmail.com"; helo=mail-ot1-f54.google.com; client-ip=209.85.210.54
Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.54])
    by pmg.mydomain.com (Proxmox) with ESMTP
    for <user1@mydomain.com>; Tue, 13 Sep 2022 08:54:44 +0800 (+08)
Received: by mail-ot1-f54.google.com with SMTP id ck2-20020a056830648200b0065603aef276so1616612otb.12
        for <user1@mydomain.com>; Mon, 12 Sep 2022 17:54:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20210112;
        h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
         :date;
        bh=uZpO4VIsRxSf3xhxOXb2hWevNTEInWgxr3yfOZqtoCQ=;
        b=RcQoXUluB/j5OJye/95mtW693THjmruZAm8Kta3N6/+t+FVxD9FQ3wpRC5hJoZWJsx
         qJ6lvy1LlKNzqx/EuAuOUaqS4CUUHHC7PqOmwyes445HU5fnt98FkCgBU7fqqmzzTtSt
         KVoqjLIUzGEzxz1L+HWKYi+3SqfF2fwwH8B18JPZHIzZR/q0GSW+q03FPca+EBwzHS6q
         vlr1rV2L3GHj5jY/YzgB/lZy+ulsVzeWQuC8r8FQwygcb64Lys+1P2hFkMT1g81h0+Bo
         hFoHgPGk/nQKd+I2MaobNoUl/acsOTcgQezA7vkG5mffLZ9jhyLn5lTekgOd0ZPJZiBH
         Qgag==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20210112;
        h=to:subject:message-id:date:from:mime-version:x-gm-message-state
         :from:to:cc:subject:date;
        bh=uZpO4VIsRxSf3xhxOXb2hWevNTEInWgxr3yfOZqtoCQ=;
        b=od8CPvgE3vXEvW4MQiLWp5b0AWJGldrMZGbGNdINpkfJy/mdeHH5eO9tHC74lo6rf0
         58oEiI2FGrDL+5+HbMD5bCAJfQwsBuhneTTeJh1/f7k3Fh60PXtLbEIdd74CTUdeg0ew
         FtKkPrRZHP/U8Mx/G1upCKnl58fA7PNgIo8SPNFmZ5gmNBWTFB7qezo1/Okgy9Wrnkk7
         XEhPFJbsbMie6mHCiwyPAygPvZAQrjgpcq/vUC+e2LldGrd6QhmwH/tHJ4PFHpCtbS3U
         SwALBHn1jcrgy817LyztXcJsztVd6hYSglV0RO1v8WLVjdBVGTBHSTikj7Y3KcuOA/lY
         iEmA==
X-Gm-Message-State: ACgBeo1lU5ngghqaX6z5ULYLyPD7McfONHOXNroq/2AWZo3zw0pLuXZd
    oSZhFm2sHKfuDuNGxjRlLQFUIGin0liw483jHzY4+iSBOsI=
X-Google-Smtp-Source: AA6agR6cRnvws0TKCALc+NZwqdyd2WyzdcwGDnFm8IB3JBZOCRFByxW784fMafStgitrIpIO9FvOqUtGxG/px6mY7OU=
X-Received: by 2002:a05:6830:6301:b0:639:36dc:1603 with SMTP id
 cg1-20020a056830630100b0063936dc1603mr11410958otb.126.1663030471964; Mon, 12
 Sep 2022 17:54:31 -0700 (PDT)
MIME-Version: 1.0
From: user1 <user1@gmail.com>
Date: Tue, 13 Sep 2022 08:54:16 +0800
Message-ID: <CAKETK8ERRaDOQBTPp5Ced2in0FzR_ZGABE-+VSm_1L5m_+BmNg@mail.gmail.com>
Subject: testing
To: "user1" <user1@mydomain.com>
Content-Type: multipart/alternative; boundary="000000000000883d7805e88474f8"
X-SPAM-LEVEL: Spam detection results:  1
    AWL                    -1.472 Adjusted score from AWL reputation of From: address
    BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
    DKIM_SIGNED               0.1 Message has a DKIM or DK signature, not necessarily valid
    DKIM_VALID               -0.1 Message has at least one valid DKIM or DK signature
    DKIM_VALID_AU            -0.1 Message has a valid DKIM or DK signature from author's domain
    DKIM_VALID_EF            -0.1 Message has a valid DKIM or DK signature from envelope-from domain
    FREEMAIL_FROM           0.001 Sender email is commonly abused enduser mail provider
    HTML_MESSAGE            0.001 HTML included in message
    LOCAL_RULE1               5.1 This is a simple test rule
    RCVD_IN_DNSWL_NONE     -0.0001 Sender listed at https://www.dnswl.org/, no trust
    RCVD_IN_MSPIKE_H3       0.001 Good reputation (+3)
    RCVD_IN_MSPIKE_WL       0.001 Mailspike good senders
    SPF_PASS               -0.001 SPF: sender matches SPF record
    T_SCC_BODY_TEXT_LINE    -0.01 -
    T_SPF_HELO_TEMPERROR     0.01 SPF: test of HELO record failed (temperror)

--000000000000883d7805e88474f8
Content-Type: text/plain; charset="UTF-8"

testing 7amada 123

--000000000000883d7805e88474f8
Content-Type: text/html; charset="UTF-8"

<div dir="ltr">testing 7amada 123<br></div>

--000000000000883d7805e88474f8--
 

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!