Use EXAMINE instead of SELECT to get the message-id.