pkernstock The API is not capable oft his and also has no need to. Use IMAP as the protocol of choice which has been designed for such things. There is no need to re-invent the wheel.
zohaib pkernstock, can you guide me regarding IMAP? Is there any call through which I can get my mailbox emails? This would be a great help.
esackbauer https://docs.mailcow.email/client/client-manual/ https://datatracker.ietf.org/doc/html/rfc3501
pkernstock IMAP is the most well-known de-facto standard for retrieving emails - beyond ActiveSync. There are hundreds of different libraries you can use if you don’t want to write your own IMAP implementation.