Bypass a subject rewrite

Someyoung Guy

Active Member
Dec 23, 2018
Hi All,

In PMG I have a subject rewrite that rewrites the subjects of an email from outside of the organization.


The first problem with it is that it works great BUT if someone has a conversation, you have it continually adding in a new [EXTERNAL SENDER] to the email subject. Is there any way to get the system to recognize the External Sender and if it has it, don't add it again?

Secondly, I have a domain that's not hosted but is "trusted" in that they don't want the [EXTERNAL SENDER] added to emails from that partner organization. I tried adding a bypass for it but it doesn't seem to work. What it ended up doing is accepting all email even from external senders and just delivering the mail essentially undoing the email subject rewrite rule because it sat in front of it.

Any help here would be appreciated on either problem.


I figured the one out.

1 - Make a "who" objects in: Mail Filter > Who Objects
2 - Add the domain or email address you want to have the bypass
3 - Click "Mail Filter" and add, the direction I had was "in" and put it as a priority higher than the subject rewrite
4 - Click on your new rule and you'll see an options section on the right hand side:

Note: You will have to click around below on "Available Objects" for these objects:
Action Objects: accept
From: Your who object
To: Hosted Domains

So you just need 3 elements, action, from and to. I tested this. When it comes from a specific domain, although I put a single email address, it hits the who (from that email address) then accepts it and sends it to the destination (hosted domains).

Not terrible!

Now...if anyone knows how to make it not keep repeating the external sender that would be awesome! I'll still muck around and see if I can get it working. Looks like I might need a regex to match the subject and if the subject already contains an "[EXTERNAL SENDER]:" > then accept it which means it'll just pass it without rewriting it again but I don't know regex.

Last edited:
Striking out here...I tried looking up regex help like at a site and others to help me write one but they pass on those sites and fail on a pmg test. Any ideas?


Passes on the site:


All I really want is to match the string: '[EXTERNAL SENDER]:' in any part of the subject and if seen, pass it.

I will keep trying but I don't understand why PMG fails it when multiple websites match.


I think I figured this out.


Test Sring:
RE: [EXTERNAL SENDER]: Yo yo ma dkddkd _ dkad

As it turns out, the system isn't doing what I thought it was anyway. When users reply back and forth I thought they were seeing the subject rewritten multiple times so for example the first inbound messages would say:

[EXTERNAL SENDER]: Whatever whatever

The second would say:


...and so forth.

The system however does not seem to be doing this so that's perfect!

This can be closed by an admin. Thanks!


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!