Can't auth to Gmail smtp via MailMessage & smtpClient

后端 未结 11 1417
遇见更好的自我
遇见更好的自我 2020-11-30 06:55

I cannot figure out for the life of my why this isn\'t working

SmtpClient smtp = new SmtpClient
{
    Host = \"smtp.gmail.com\",
    Port = 587,
    UseDefau         


        
11条回答
  •  被撕碎了的回忆
    2020-11-30 07:14

    I had this problem before and fixed it by following these steps:

    1. Go to "My Account" settings.
    2. Click "Sign-in & Security" category.
    3. Scroll down to "Connected apps & sites" section.
    4. turn off the "Allow less secure apps" option.

    I just turned this option off and my code ran successfully.

提交回复
热议问题