.Net 1.1中发送邮件使用System.Web.Mail.而到.Net 2.0中发送邮件建议使用System.Net.Mail,不推荐使用System.Web.Mail,但是原来的还能用,今天将原来1.1发送程序改写成2.0,但是一直是发送失败,一直被诺顿拦截,很奇怪,而且把诺顿Internet Email Auto Protected关闭就能发送出去.原来1.1从来没有诺顿拦截现象.

根据上面的链接查询Symantec Support KB,解释如下:
1  Start Outlook Express. 
2  Click the Tools menu, and then click Accounts. 
3  In the Internet Accounts list, click the name of the account that you use to send email. 
4  Click Properties.
5  Click the Advanced tab.
6  Under Server Timeouts, drag the slider so that the number of minutes increases. The maximum time that you can set it to is 5 minutes.
7  Click OK. 
8  Click Close.

晕死,设置发送超时时间为 5 Min

但是将发送TimeOut设为5*60*1000仍然发送失败,搞不懂了

 1public void SendNetSmtpMail2()
 2        {
 3            System.Net.Mail.MailMessage oMsg = new System.Net.Mail.MailMessage();
 4            // Set the message sender
 5            oMsg.From = new System.Net.Mail.MailAddress("upzone@126.com", "upzone");
 6            // The .To property is a generic collection, 
 7            // so we can add as many recipients as we like.
 8            oMsg.To.Add(new System.Net.Mail.MailAddress("upzone@126.com", "upzone"));
 9            // Set the content
10            oMsg.Subject = "My First .NET email";
11            oMsg.Body = "Test body - .NET Rocks!";
12            oMsg.IsBodyHtml = true;
13            System.Net.Mail.SmtpClient oSmtp = new System.Net.Mail.SmtpClient("smtp.126.com");
14            //You can choose several delivery methods. 
15            //Here we will use direct network delivery.
16            oSmtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
17            oSmtp.Timeout = 5 * 60 * 1000;
18            //Some SMTP server will require that you first 
19            //authenticate against the server.
20            NetworkCredential oCredential = new NetworkCredential("upzone", "123456");
21            oSmtp.UseDefaultCredentials = false;
22            oSmtp.Credentials = oCredential;
23            //Let's send it already
24            oSmtp.Send(oMsg);
25
26        }

发送不成功,没有办法,只好改回原来1.1的发送程序,等解决了2.0的问题再说了.

 1        public void SendSmtpMail()
 2        {
 3            System.Web.Mail.MailMessage mail = new System.Web.Mail.MailMessage();
 4            mail.To = "upzone@126.com";
 5            mail.From = "upzone@126.com";
 6            mail.Subject = "this is a test email.";
 7            mail.Body = "Some text goes here";
 8            mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication 
 9            mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "upzone"); //set your username here 
10            mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "123456"); //set your password here 
11
12            System.Web.Mail.SmtpMail.SmtpServer = "smtp.126.com"; //your real server goes here 
13            System.Web.Mail.SmtpMail.Send(mail); 
14
15        }

转载于:https://www.cnblogs.com/upzone/archive/2006/04/25/384343.html

奇怪的问题,.Net 2.0发送邮件失败...相关推荐

  1. 通过QQ邮箱的SMTP服务器发送QQ邮件至163邮箱提示“发送邮件失败”的解决方案(三种可能性,不妨一试)...

    IDE:Visual Studio 2010[C#] + .NET 4.0框架 引用.NET 4.0框架的System.Net.Mail命名空间开发发送邮件的程序.发送方:QQ邮箱 接收方:163邮箱 ...

  2. jenkins + jmeter +ant 发送邮件失败

    阿菠萝阿瑶 </div><!--end: blogTitle 博客的标题和副标题 --> <div id="navigator"> 博客园 首页 ...

  3. 阿里云邮免费企业邮箱使用smtp发送邮件失败(SMTP开启、配置问题)

    阿里云邮免费企业邮箱使用smtp发送邮件失败(SMTP开启.配置问题) 企业邮箱 在Foxmail 7.0上POP3/IMAP协议设置方法 Foxmail 7.0 POP3/IMAP 设置方法如下: ...

  4. linux发邮件失败,Linux SendMail发送邮件失败诊断案例,sendmail发送邮件

    Linux SendMail发送邮件失败诊断案例,sendmail发送邮件 Linux上Sendmail经常由于一些配置问题,导致邮件发送失败,下面整理.收集了一些邮件发送失败.异常的案例. 案例1: ...

  5. Postfix 发送邮件失败问题,求大神

    Postfix 发送邮件失败问题,求大神 Dec 14 11:22:44 mail postfix/smtp[6192]: connect to mx2.qq.com[240e:ff:f040:28: ...

  6. 向smtp发送邮件失败

    今天,我的程序向smtp发送邮件失败,得到错误 Unable to read data from the transport connection: net_io_connectionclosed. ...

  7. WPF .NET 4.0 OpenClipboard 失败 (异常来自 HRESULT:0x800401D0 (CLIPBRD_E_CANT_OPEN)) BUG解决

    WPF .NET 4.0 OpenClipboard 失败 (异常来自 HRESULT:0x800401D0 (CLIPBRD_E_CANT_OPEN)) BUG解决 参考文章: (1)WPF .NE ...

  8. node项目发送邮件失败

    title: node项目发送邮件失败 date: 2018-05-07 10:46:43 tags: 防坑指南 categories: 防坑指南 描述问题 搭建一个node项目时,需要在注册时发送邮 ...

  9. ButterKnife 8.4.0 @BindView 失败,nullpointerexception

    ButterKnife 8.4.0 @BindView 失败,空指针异常,跟踪进去,发现是XXXFragment的 XXXFragment$$ViewBinder 的类没有生成. 经过google.发 ...

最新文章

  1. HDFS二次开发常见问题
  2. Winform开发框架之通用高级查询模块--SNF快速开发平台3.3-Spring.Net.Framework
  3. 电商人:别再跟数据透视表苦苦挣扎,这个报表神器才是你最后出路
  4. c# 火狐浏览器怎么嵌入窗体中_「C#上位机必看」你们想要的练手项目来了
  5. Arbor Networks Spectrum新安全平台发布:高级威胁平台通过内部企业网络连接互联网上的攻击...
  6. android+刷机文件,【技术】刷机脚本文件的修改
  7. 动手学深度学习笔记3.1+3.2+3.3
  8. nsh 自定义启动脚本
  9. 网友:我30多岁了,现在转行学编程来得及吗?
  10. win7笔记本外接显示器html,详解笔记本电脑连接外部显示器的操作流程
  11. 软件实习项目2——贪吃喵(猫吃鱼版贪吃蛇)(实验准备与设计)
  12. MC9S12XS128硬件底层驱动_set_bus_clk.h(总线时钟设置)
  13. 【S0021】【素材】创意几何海报、h5背景
  14. 跨界转型 打造大数据旗舰
  15. 纯CSS实现淘宝天猫优惠券效果
  16. 设计模式看这篇就够了
  17. Python接口获取12306火车票信息
  18. MATLAB在线编辑器online
  19. 一个使用javafx编写电子相片管理程序
  20. PiMuseum-游戏开发入门级教程-中国象棋-Chapter-3

热门文章

  1. 1053 Path of Equal Weight
  2. oracle多线程类连接数,数据库连接数,服务器进程,线程之间什么关系?
  3. java获取注解信息_java 自定义注解,获取注解信息
  4. 分享到facebook链接原格式_神马?!你还不知道Facebook广告怎么操作?
  5. java堆外内存6_Java堆外内存排查小结
  6. 参考平面及其高度_GCB | 盐沼和红树林湿地类型的转变会改变亚热带湿地对于海平面上升的脆弱性么?...
  7. java sessionid长度_php中session_id()函数详细介绍,会话id生成过程及session id长度
  8. html5 如何局部放大,【HTML5特效】挺简单的HTML5放大效果
  9. 前端ui框架_跨屏建站发布同名响应式前端ui框架
  10. mqtt调试助手_物联网入门,如何使用MQTT协议,连接Tlink物联网平台