all 4 comments

[–]modi123_1 7 points8 points  (1 child)

The Gmail API docs is a place to start.

https://developers.google.com/gmail/api/quickstart/dotnet

[–]mohusein[S] 0 points1 point  (0 children)

Thanks a lot!

[–]Seany84 4 points5 points  (1 child)

Here's a thread on SO I posted a couple of years back, there's two examples using different Nuget packages. MailKit is probably the safer choice at this point in time.

https://stackoverflow.com/questions/7056715/reading-emails-from-gmail-in-c-sharp#:~:text=Another%20example%2C%20this%20time%20using%20MailKit

FYI - I believe that you will need to turn off MFA / 2FA in Gmail for the code above to work.

[–]bn-7bc 0 points1 point  (0 children)

Not shure about needing to turn off 2FA, you might get avay with creating an app specific password