Match Field - Multi Line Regex for To Field

Hi

Trying to use a What Object with Match Field regex. I believe some mail clients sent the To field in more than one line.

It seems Perl has a /s modifier which lets lets . match newline - but I can't seem to use /s in the pmg config interface (Test String fails).

Do you have advice for writing a regex that would match things in the To field of an email which spans multiple lines?
 
Could you share such an email (the complete mail with headers in a code-block)
maybe we can find something fitting.
 
on a quick test this seems to work fine here:
Code:
From: sender <sender@sender.domain.example>
To: receiver@domain.example, support@test1.domain.example
 support@test2.domain.example
Bcc: 
Subject: test 
[code]

gets matched by To=(support@.*){2,}

What would not get matched is 2 'To' headers each with one containing one 'support@' - afaict
 
Hi, side note: would be great to also stop people from sending:

To: support@foo
Cc: support@bar
That's not really possible with the current rulesystem - it matches certain headers with regex - there is no possiblity to join multiple different headers together and match on those.
 
  • Like
Reactions: Joe Botha
Hi, is the regex logic in Perl?

Perl seems to support this with /s

Maybe this should be the default behaviour for match-field setting.
No - not quite - this is how the headers are extracted from the mail - the for loop I linked iterates over all occurrences of a To header individually so the /s switch would not help - and if it's only one header with multiple lines - those are joined together on extraction so /s is not needed.

Thanks for the enhancement request.
 

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!