Hi Calvin,
may I know if you set messages as inbox items as below?
------------
# Access to the email in the inbox
messages = inbox.Items
# get the first email
message = messages.GetFirst()
----------------
If this cannot work, can you perhaps try with messages.Last() and see what happen?