Then, if $error_message contains anything, an error message should be displayed instead of sending an email.

I suppose that is the string contains only latin symbols, cyrillic symbols, numbers, comma, dot, space or "-", the check should be OK and the email should be sent. But in reality it seems so that the test gives an error depending on what cyrillic symbols are there in the string.