Sama55 is right. There are 2 flags:
- QA_USER_FLAGS_NO_MESSAGES: Controls whether the user doesn't want to receive private messages from other users
- QA_USER_FLAGS_NO_MAILINGS: Controls whether the user doesn't want to receive messages sent from the admin/mailing section
Bear in mind that they should be queries this way
$useraccount['flags'] & QA_USER_FLAGS_NO_MESSAGES
Also note, for some reason, the meaning is negative itself "no messages", so you have to always negate the whole condition and not the constant in its own as shown in the link.