SmtpClient with Gmail

后端 未结 6 716
忘了有多久
忘了有多久 2020-11-29 03:47

I\'m developing a mail client for a school project. I have managed to send e-mails using the SmtpClient in C#. This works perfectly with any server but it doesn

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-29 04:36

    You need to enable 2-Step Verification in your gmail account and create an app password (https://support.google.com/accounts/answer/185833?hl=en). Once you replace your password with the new app password, it should work.

    Credentials = new System.Net.NetworkCredential("your email address", "your app password");
    

提交回复
热议问题