How to send email by using MailKit?
The first thing you need to do is follow Google’s instructions for obtaining OAuth 2.0 credentials for your application. Once you’ve done that, the easiest way to obtain an access token is to use Google’s Google.Apis.Auth library: var certificate = new X509Certificate2 (@”C:\path\to\certificate.p12″, “password”, X509KeyStorageFlags.Exportable); var credential = new ServiceAccountCredential (new ServiceAccountCredential .Initializer (“[email protected]”) { … Read more