I found that the mailbox needs to be open and the mail has to have been read. try adding
Code:
RequestReadMail(mailId)
before your code. The other issue I found is you need to wait for a response back from the event
Code:
EVENT_MAIL_NUM_UNREAD_CHANGED
before it takes effect