Hello!
We have a client who wants to redirect emails containing certain attachments to another email address for review, but I'm having some problems making a body regex that works without issues for his needs. Ex, [email protected] receives an email with a zip file, that needs to be copied to [email protected] instead.
At first, I put in a body matches regex condition with this statement:
Content-Disposition: attachment; filename=".*.zip"
Only to notice that CPanel removed the " symbol when I edit the filter anew. I figured I'd try it, but the end result is that even if an attachment is not a zip file, if the letters zip are found later in the email, the .* in the regex catches the letters and matches the filter.
I then tried to emphasize the . and the " by putting escaping them with a \ but that didn't work as well as I would have liked, the filter did not work.
Content-Disposition: attachment; filename=\".*\.zip\"
Filter error: error while compiling regular expression "Content-Disposition: attachment; filename=\".*\.zip\": \ at end of pattern at offset 52
Doubling them was recommended elsewhere, but while CPanel accepted the filter then, it's not matching it as I test it.
As I am not a guru with regexes, I'm turning here for help if somehow can help me along with a pointer or a solution that would work!
Thanks for your time!
We have a client who wants to redirect emails containing certain attachments to another email address for review, but I'm having some problems making a body regex that works without issues for his needs. Ex, [email protected] receives an email with a zip file, that needs to be copied to [email protected] instead.
At first, I put in a body matches regex condition with this statement:
Content-Disposition: attachment; filename=".*.zip"
Only to notice that CPanel removed the " symbol when I edit the filter anew. I figured I'd try it, but the end result is that even if an attachment is not a zip file, if the letters zip are found later in the email, the .* in the regex catches the letters and matches the filter.
I then tried to emphasize the . and the " by putting escaping them with a \ but that didn't work as well as I would have liked, the filter did not work.
Content-Disposition: attachment; filename=\".*\.zip\"
Filter error: error while compiling regular expression "Content-Disposition: attachment; filename=\".*\.zip\": \ at end of pattern at offset 52
Doubling them was recommended elsewhere, but while CPanel accepted the filter then, it's not matching it as I test it.
As I am not a guru with regexes, I'm turning here for help if somehow can help me along with a pointer or a solution that would work!
Thanks for your time!