I'm sure it is a good start at this, but what actually goes wrong? Does it fail to send mail, fail to detect the line, or something else?
If the log file is updated a lot, you are also firing up multiple sub-process for each line written to it. Could you do something more economical like:-
pattern="WRONG CRITERIA FOUND"
tail -fn0 logfile | \
grep "$pattern" | \
while read line
do
.... do something ...
done
In bash you could maybe try the neater:-
pattern="WRONG CRITERIA FOUND"
while read line
do
... do something ...
done < <(tail -fn0 logilfe | grep "$pattern")
Did you consider the -F (upper case!) option to tail to deal with the log file rotation?
And, your code snippet - although not too logical nor efficient - doesn't seem "wrong". So please answer rbatte1's question - WHAT doesn't do what you want? Did you try the proposals in the thread from which you borrowed your code?