This is an anti-spam measure called a
challenge-response authentication.
In computer security, challenge-response authentication is a family of
protocols in which one party presents a question ('challenge') and another
party must provide a valid answer ('response') to be authenticated.