Value assign in if condition part

Sajawal

Well-Known Member
Sep 10, 2020
57
7
8
Pakistan
cPanel Access Level
Root Administrator
Hi,
I like to know if I can assign value to a variable in the if-statement condition part, below example will help you to understand the scenario.

I modified the Exim filter file and defined some keywords (more than 500) that if those keywords are found in the email subject then the email will be rejected. Now I want to store the value of that word that matches the condition write it on the bounceback message or in the error log file.

I want to do something like that,


if
("$h_subject:" contains "aaa" and variable="aaa")
or ("$h_subject:" contains "aab" and variable="aab")
or ("$h_subject:" contains "aac" and variable="aac")
.
.
.
or ("$h_subject:" contains "zzz" and variable="zzz")
then
fail text "Word found Mail reject, the word found $variable"
endif

The $variable value contains which I have assigned above in if condition after and operator.

Let me know if this is possible or any other alternative way to achieve it.

regards,
Sajawal