Quantcast
Channel: Questions in topic: "exception"
Viewing all articles
Browse latest Browse all 470

SmtpException: 535-5.7.8 Username and Password not accepted

$
0
0
I am developing a project for android with unity 2020.1 first I have made a function that sends a mail with some code to let the user login. and it worked fine. but now after some days(4-5 days), I keep getting this error SmtpException: 535-5.7.8 Username and Password not accepted then I changed my password again I got this error then I created a new Gmail account and used it but still getting this error note - I am using my credentials correctly. MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com"); SmtpServer.Timeout = 10000; SmtpServer.DeliveryMethod = SmtpDeliveryMethod.Network; SmtpServer.UseDefaultCredentials = false; SmtpServer.Port = 587; mail.From = new MailAddress("mygmail"); mail.To.Add(new MailAddress(emailInput.text)); emailToDb = emailInput.text.ToString(); mail.Subject = " "; int randNom = UnityEngine.Random.Range(1111, 999999); codeLogin = randNom; mail.Body = randNom.ToString(); SmtpServer.Credentials = new System.Net.NetworkCredential("mygmail", "mypassword") as ICredentialsByHost; SmtpServer.EnableSsl = true; ServicePointManager.ServerCertificateValidationCallback = delegate (object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; }; mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure; SmtpServer.Send(mail);

Viewing all articles
Browse latest Browse all 470

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>