I'm trying to send an E-Mail via Gmail using MailKit. This is my code:
using MailKit.Net.Smtp;
using (var client = new SmtpClient())
{
client.Connect("smtp.gmail.com", 587, false);
//...
}
But no matter what I try I always get the following exception:
System.IO.IOException: The authentication or decryption has failed.
I already tried to enable "unsafe apps" in my Google account, but that did not help. So far I could not find any working example that shows how to send mail via Gmail.
Edit: I just tried running the Code on WIndows (using .NET), and it worked perfectly. The E-Mail got sent right away. Only when I run it on Linux/OSX using Mono, it does not work.