Blocking Emails by Subject in Proxmox Mail Gateway

It is possible to block by subject using the PMG. My reasoning for doing this is that I want to continue to get emails from certain parties but I don’t want to get certain regular spam from them. For instance, I’m not interested in Google My Business. I do want to continue to get emails from Google just in case I need to reset my password, etc.

To do this it consists of 3 parts.

The first is to create a “what object”. This can be found under the “Mail Filter” menu on the left side of the window. Here you click to create the what object by giving it a name and a description.

The second part is to click on your new “what object” and focus your eyes on the window pane just to the right of it. In here you’ll see the ability to create a new filter. What you want to do is click on the add button and choose “match field“. In the “field” type “subject”. Then in the value enter (?i). The first part here in parentheses is a way to tell it to ignore case. Then you type the string that you want to match. An example would be “(?i)google my business”

After this is saved then go back to the menu on the left of the window and click “mail filter”. Here’s where you create the actual rule. Click Add to add a new rule that will be based on your what object’s matching field contents. When you click add you will need to give it a name, a priority, a direction, and activate it.

Once that is done then you can click on your rule to set the parameters for the rule. The parameters are what you want done and what object you are working with. The action tells it how you want to deal with the rule. For instance, you want to block it or quarantine it. There is a row of tabs under the section “available objects”. Choose the “what” and find your what object. Then click the plus symbol to add it. Then click on the Action tab and tell it what you want done.

That’s the gist of it. After this is done you need only edit your what object to add new subjects.

To extend this you can create custom “who objects” and “what objects” and combine them in the mail filter to allow some emails but block others from that same sender by the subject. You do not need to block everything. You can just dump them in quarantine, or do something else.

I tested this and it works well. I can now safely know that google can send all the emails they want to me but I get to say which ones get in front of my eyes.