相关疑难解决方法(0)

如何在vb.net中发送Gmail电子邮件?

我想发送一封电子邮件,但它给了我一个错误.

我有这个代码:

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为什么我得到这个错误?以及如何解决?

vb.net email gmail smtp

5
推荐指数
2
解决办法
4万
查看次数

标签 统计

email ×1

gmail ×1

smtp ×1

vb.net ×1