I am getting an error when sending Email through c# code in my Android App
534-5.7.14 Please log in via your web browser and 534-5.7.14 then try again. 534-5.7.14 Learn more at 534 5.7.14 https://support.google.com/mail/answer/78754 n10sm18967460pap.16 - gsmtp
MailMessage message = new MailMessage();
message.From = new MailAddress("xxx@gmail.com");
message.To.Add(new MailAddress("xxx@gmail.com"));
message.Subject = "Hai";
message.Body = "test mail";
SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
client.EnableSsl = true;
client.Credentials = new System.Net.NetworkCredential("xx@gmail.com", "password");
ServicePointManager.ServerCertificateValidationCallback = delegate(object sende,X509Certificate certificate, X509Chain chain, System.Net.Security.SslPolicyErrors sslpolocy) {
return true;
};
//client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Send(message);
Toast.MakeText(this, "Sending mail...", ToastLength.Long).Show();
I am sending email in Xamarin But i am getting above exception . Canyou please help me how can i resolve.
Here is a solution which I found online and it did work for me :
This approach was encountered quite accidentally, so Google Help authors should write more specific about this OR Google developers should try to reproduce and fix this issue.
Link to this original article is here
在我的gmail设置中启用“允许安全性较低的应用程序”后,其工作正常。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.