i getting error when sending email through c# code in android app
534-5.7.14 please log in via web browser , 534-5.7.14 try again. 534-5.7.14 learn more @ 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 sending email in xamarin getting above exception . canyou please me how can resolve.
here solution found online , did work me :
- open standard non-incognito google window (i reference window 1) , logout google account.
- open incognito google window (i reference [2]) , logout google account.
- in window 1, login personal email xx@gmail.com
- in window 1, open account security settings navigating account -> sign-in & security , scroll down "allow less secure apps" setting. if setting turned on, turn off, wait 5 seconds, , turn on again (this quite crucial far understand). if setting turned off, turn on.
- in window 1, open https://accounts.google.com/displayunlockcaptcha link , click button unlock captcha. 5.1. not in 1
- in window 2, login company email or other email
- in window 2, open https://accounts.google.com/displayunlockcaptcha link , click button unlock captcha
- in window 2, in mail.google.com tab, open settings -> accounts, click add email address own
- in opened modal window, enter whatever name , personal email address - xx@gmail.com , click next step
- smtp server should set smtp.gmail.com, port 587, username xx@gmail.com (not john.doe), type in password personal xx@gmail.com address (please note don't have 2 step verification enabled, if have - please note may need enter different password)
- click connect , won't receive noisy "server response: 534-5.7.14" error
this approach encountered quite accidentally, google authors should write more specific or google developers should try reproduce , fix issue.
link original article here
Comments
Post a Comment