从vb.net桌面应用程序发送电子邮件时出错 [英] Error sending email from vb.net desktop application

查看:133
本文介绍了从vb.net桌面应用程序发送电子邮件时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我从vb.net应用程序发送电子邮件时收到以下错误消息。



{连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立连接失败,因为连接主机未能回应74.125.130.109:587}







以下是我的代码

  Dim  SimpleSMTP  As   SmtpClient(  smtp.gmail.com
使用 SimpleSMTP
.Port = 587
.EnableSsl = True
.Credentials = NetworkCredential(gmailusername,gmailpassword)
.Send(AnEmailMessage)
结束 使用

解决方案

使用代码:



  Dim  s  As   SmtpClient 
s.Host = smtp.gmail.com
s.Port = 587
s.EnableSsl = True
' s.Timeout = 200
s.Credentials = NetworkCredential( youremail@gmail.com yourpassord

Dim m 作为 MailMessage
m。 .Add( useremail@hotmail.com
m.From = MailAddress( youremail@gmail.com
m.Subject = subiect text
m.Body = 电子邮件正文
s。发送(m)
Label6.Text = 发送电子邮件


Pls help i am getting below error message at the time of sending email from vb.net application.

"{"A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 74.125.130.109:587"}"




Below is my code

Dim SimpleSMTP As New SmtpClient("smtp.gmail.com")
            With SimpleSMTP
                .Port = 587
                .EnableSsl = True
                .Credentials = New NetworkCredential(gmailusername, gmailpassword) 
                .Send(AnEmailMessage)
            End With

解决方案

use the code :

Dim s As New SmtpClient
       s.Host = "smtp.gmail.com"
       s.Port = 587
       s.EnableSsl = True
       's.Timeout = 200
       s.Credentials = New NetworkCredential("youremail@gmail.com", "yourpassord")

       Dim m As New MailMessage
       m.To.Add("useremail@hotmail.com")
       m.From = New MailAddress("youremail@gmail.com")
       m.Subject = "subiect text"
       m.Body = "email body text"
       s.Send(m)
       Label6.Text = "sent email"


这篇关于从vb.net桌面应用程序发送电子邮件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆