"未能发送邮件"错误

时间:2015-09-28 08:23:40

标签: vb.net

我一直致力于大学项目,允许将电子邮件提醒发送给特定客户。我遇到了一些我实际上无法发送电子邮件的问题。它一直给我错误信息"未能发送邮件"这对我的工作没有多大帮助。这是我的代码,非常感谢任何帮助。

Imports System.Web
Imports System.IO
Imports System.Net.Mail

    Dim mail As New MailMessage()
    Dim SmtpServer As New SmtpClient
    SmtpServer.Credentials = New Net.NetworkCredential("email@gmail.com", "password")
    SmtpServer.Port = 587
    SmtpServer.Host = "smtp.gmail.com"
    SmtpServer.EnableSsl = True
    SmtpServer.EnableSsl = True
    mail.To.Add("recievingemail@hotmail.co.uk")
    mail.From = New MailAddress("email@gmail.com")
    mail.Subject = "Match Reminder"
    mail.Body = "A reminder that you have an upcoming match this week, please check match details."
    SmtpServer.Send(mail)

0 个答案:

没有答案