在asp.net中发送邮件失败 [英] Send mail failure in asp.net

查看:77
本文介绍了在asp.net中发送邮件失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下代码发送邮件.

I am using following code to send mail.

SmtpClient smtp = new SmtpClient();
      smtp.Host = "relay-hosting.secureserver.net";
      smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
      smtp.UseDefaultCredentials = false;
      smtp.Credentials = new System.Net.NetworkCredential("username","pass");
      MailMessage mail = new MailMessage(fromname, toname, heading, message);
      mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
      mail.IsBodyHtml = true;
      smtp.Send(mail);



有时会显示发送邮件失败.有时邮件可以正确发送,但是要超过半天才能将该邮件发送到地址.如何解决此问题.



Some time it display sending mail failure. and sometime the mail send correctly,but it takes more than half day to reach that mail to toaddress.How to solve this problem.

推荐答案

您不能.到达服务器需要的时间取决于您的邮件服务器.根据错误消息的类型,您的服务器或与服务器的网络连接可能会出现其他问题,但是如果有时可以正常工作,那么最有可能说的是这段代码很好,但是邮件服务器您正在连接,不是.
You can''t. How long it takes to arrive is a function of your mail server. Depending on what the error message is, you could have other issues with your server, or with your network connection to the server, but if it works sometimes, then the most likely thing to say is that this code is fine, but the mail server you''re connecting to, is not.


这篇关于在asp.net中发送邮件失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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