c# - Error: 'device not Configured' when Sending Email in .NetCoreApp V1.0 using Mailkit -
i'm developing asp .net core application using vs code on mac. researched on how send email since system.net.mail not supported, came across mailkit. added following dependencies json file: mailkit v1.6.0 , mimekit v1.6.0.
but error on:
var certificate = new x509certificate2 (@"c:\path\to\certificate.p12", "password", x509keystorageflags.exportable); var credential = new serviceaccountcredential (new serviceaccountcredential .initializer ("your-developer-id@developer.gserviceaccount.com") { scopes = new[] { "https://mail.google.com/" }, user = "username@gmail.com" }.fromcertificate (certificate)); using (var client = new smtpclient()) { client.connect("smtp.gmail.com", 587); // error occurs here. client.authenticate ("mymail@gmail.com", credential.token.accesstoken); client.send(message); client.disconnect(true); }
i searched solution online couldn't find anything. has ever come across error before , if so, how did manage fix it?
thanks.
Comments
Post a Comment