Example for a very simple IMAP client using c#, devexpress and ImapX
For gmail server please nottice about their security settings: https://support.google.com/mail/thread/21528208?hl=en
For DevExpress go there: https://go.devexpress.com/DevexpressDownload_UniversalTrial.aspx and you will probable need to convert project for latest version.
Used platform: .NET Framework 4.8, feel free to upgrade to .NET 5.0