Can't auth to Gmail smtp via MailMessage & smtpClient

后端 未结 11 1419
遇见更好的自我
遇见更好的自我 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:13

    
                
                    
                
    
    

    Edit: try adding this line smtp.Credentials = Credentials after this

    Credentials = new NetworkCredential("myemail@gmail.com", "myGmailPasswordHere"),

提交回复
热议问题