发送电子邮件失败 [英] Failure Sending Email
本文介绍了发送电子邮件失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试从ASP.ne发送邮件。
但我收到错误
I am trying to send mail from ASP.ne.
But I am getting the error
"Failure Sending Mail: Unable to read data from the transport connection: net_io_connectionclosed".
我提供了网络凭据。我的SMTP端口已打开。
以下是我的代码
I have provided network credentials. and my SMTP port is opened.
Below is my code
StreamReader reader = new StreamReader(Server.MapPath("~/ForgetPassword.htm"));
string readFile = reader.ReadToEnd();
string myString = "";
myString = readFile;
myString = myString.Replace("$$Name$$", name);
myString = myString.Replace("$$Email$$", txtEmail.Text);
//myString = myString.Replace("$$Password$$", password);
System.Net.Mail.MailMessage Msg = new System.Net.Mail.MailMessage();
MailAddress fromMail = new MailAddress("xxx@xx.com");
// Sender e-mail address.
Msg.From = fromMail;
// Recipient e-mail address.
Msg.To.Add(new MailAddress(txtEmail.Text));
// Subject of e-mail
// subject += txtEmail.Text;
Msg.Subject = subject;
Msg.Body = myString.ToString();
Msg.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = host;
smtp.Port = port;
smtp.UseDefaultCredentials = false;
smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
smtp.Credentials = new NetworkCredential("uid", "pwd");
smtp.EnableSsl = true;
smtp.Timeout = 20000;
smtp.Send(Msg);
ScriptManager.RegisterClientScriptBlock(this, GetType(), "Authentication Type", "javascript:alert('Password has been sent to your Email');", true);
reader.Dispose();
请帮助。在此先感谢
Please help. Thanks in advance
推荐答案
名称
,name);
myString = myString.Replace (
", name); myString = myString.Replace("
电子邮件
这篇关于发送电子邮件失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文