GMail SMTP via C# .Net errors on all ports

前端 未结 7 1602
鱼传尺愫
鱼传尺愫 2020-11-27 17:35

I\'ve been trying for a whlie on this, and have so far been failing miserably. My most recent attempt was lifted from this stack code here: Sending email through Gmail SMT

7条回答
  •  野性不改
    2020-11-27 17:52

    I implemented an email client sometime back that could talk to gmail on both 587 and 465...

    Port 25 is the normal unencrypted pop port; not available on gmail.

    The other two ports have encryption; 587 uses TLS, 465 uses SSL.

    To use 587 you should set SmtpClient.EnableSsl = true.

    465 wont work with SmtpClient, it will work with the deprecated class SmtpMail instead.

提交回复
热议问题