Vb.net-发送邮件时间段错误或已建立

时间:2018-08-07 20:53:33

标签: vb.net smtpclient

嘿,我正在尝试使用gmail.com中的vb.net发送文件,但问题是我收到了“时间段错误,或者由于连接的主机无法响应64.233.166.108:567,建立的连接失败” “

我不确定问题是什么,我在任何地方都找不到答案:(

感谢您的帮助!

代码:

 Using mail As New MailMessage
            mail.From = New MailAddress("....@gmail.com")
            mail.To.Add("........@gmail.com")
            mail.Body = "Computer info Below"
            Path = "C:\Users\" & Environment.UserName & "\Pictures\hello.txt"
            Dim attach As New Attachment(Path)
            mail.Attachments.Add(attach)
            mail.Subject = Environment.UserName
            mail.Priority = mail.Priority.Normal
            Using SMTP As New SmtpClient
                SMTP.EnableSsl = True
                SMTP.Port = "567"
                SMTP.Host = "smtp.gmail.com"
                SMTP.Credentials = New Net.NetworkCredential("....@gmail.com", "******")
                SMTP.Send(mail)
            End Using
        End Using

1 个答案:

答案 0 :(得分:0)

您确定该端口吗?给587端口一个机会:) – Jimi

已解决