I've gone back to your original post, moved a brace to the right place
and added a logic check on the second part of the "and" group.
${if
and{
{eq
{$h_X-spam_flag:}
{YES}
{1}
{0}
}
{eq
${lookup mysql{MYSQL_Q_DROPSPAM}}
{1}
{1}
{0}
}
}
}
The fact you were missing a test - "eq" - on the second section made the
whole thing rather misleading, but as a lookup could return a statement
in itself the statement was syntactically correct *before* expansion.
Graeme