Is there any way to read mail contents using msbuild? Any custom tasks or community tasks available to achieve this?
You can create your own custom task.
See these links for example code:
Read MS Exchange email in C#
C# MAPI to read exchange server inbox
Read Gmail Inbox