I am trying to PREPEND some dynamic data with postfix header_checks. Namely, my mailing software doesnt support List-unsubscribe feature, so I am trying to overcome that with prepending it with postfix header_checks
My regex is currently like this
/^To:(.*)$/ PREPEND List-Unsubscribe: https://www.example.com/unsubscribe.php?list=1&email=$1
However, when it gets rewritten, or rather added to email header that link becomes
https://www.example.com/unsubscribe.php?list=1&email= [email protected]
So, my question is basically how to remove that leading whitespace from regex above?
thanks in advance
You may actually consume the whitespace(s) with
\s*
(=zero or more whitespaces):See the regex demo.
If the email is just a chunk of non-whitespace characters after 0+ whitespaces, you may even use
where
\S+
matches one or more characters other than whitespace.