我想发送一封电子邮件,但它给了我一个错误.
我有这个代码:
Sub sendMail(ByVal title As String, ByVal content As String)
Dim SmtpServer As New SmtpClient("smtp.gmail.com", 25)
SmtpServer.Credentials = New Net.NetworkCredential("name@gmail.com", "password")
Dim mail As New MailMessage("name@gmail.com", "name@gmail.com", title, content)
SmtpServer.Send(mail)
End Sub
Run Code Online (Sandbox Code Playgroud)
我有一个try catch试图调用这个方法,它不起作用所以catch运行,我得到了例外:System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first. b6sm3176487lae.0 - gsmtp为什么我得到这个错误?以及如何解决?