这是我的代码。
Dim SmtpServer As New Net.Mail.SmtpClient("smtp.gmail.com", 25)
SmtpServer.Credentials = New Net.NetworkCredential("xxxxxx@gmail.com", "xxxxxxxxxx")
Dim email As New Net.Mail.MailMessage("xxxxxx@gmail.com", _to, _subject, _message)
email.Subject = _subject
email.Body =
"<html>" & _
"<head>" & _
"<meta http-equiv=""Content-Language"" content=""fr"">" & _
"<meta http-equiv=""Content-Type"" content=""text/html; charset=windows-1252"">" & _
"</head>" & _
"<body>" & _
_message & _
"</body>" & _
"</html>"
SmtpServer.EnableSsl = True
Try
SmtpServer.Send(email)
Return "OK"
Catch ex As Exception
Return ex.Message
End Try