@SHAISTA I gave an example on how to record to download an attachment from google drive. not from IMAP or Gmail. Gmail attachment is different than google drive attachment. You have to handle it in a different way when you use mail API.
please check out above post.