惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
T
Threatpost
Latest news
Latest news
N
News | PayPal Newsroom
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Help Net Security
Help Net Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
AI
AI
Simon Willison's Weblog
Simon Willison's Weblog
TaoSecurity Blog
TaoSecurity Blog
The Last Watchdog
The Last Watchdog
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
T
Threat Research - Cisco Blogs
O
OpenAI News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
The Exploit Database - CXSecurity.com
NISL@THU
NISL@THU
Application and Cybersecurity Blog
Application and Cybersecurity Blog
S
Securelist
小众软件
小众软件
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Martin Fowler
Martin Fowler
S
SegmentFault 最新的问题
Cisco Talos Blog
Cisco Talos Blog
云风的 BLOG
云风的 BLOG
AWS News Blog
AWS News Blog
GbyAI
GbyAI
N
News and Events Feed by Topic
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
美团技术团队
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
S
Schneier on Security
博客园 - 聂微东
V2EX - 技术
V2EX - 技术
T
Troy Hunt's Blog
SecWiki News
SecWiki News
S
Secure Thoughts
B
Blog RSS Feed
Hugging Face - Blog
Hugging Face - Blog
WordPress大学
WordPress大学
腾讯CDC
H
Heimdal Security Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Privacy International News Feed

博客园 - Brendan

[转载]Manually configuring Microsoft Internet Information Services (IIS) IIS与TOMCAT协同工作---在IIS下运行JSP页面 AXIS部署错误解决方案集锦 类的XML序列化(XML Serialization) [翻译]你可以赚钱,但你不能赚时间 Windows 2003 Server配置IIS服务器(ASP, ASP.NET)全功略 Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive 用MS SQL Server事件探查器来跟踪数据库的操作 反反编译工具——Deploy.NET C中获取当前时间的函数 Buffered I/O 与 Non-Buffered I/O性能差异的实例体验 替换函数(Substitution Function) 主定理(Master Theorem) Dynamic Programming之Longest Increasing Subsequence (LIS)问题 ADO.NET数据库连接模块 ASP.NET控件事件丢失的探究 SQLDMO For C#(翻译) 关联(Association)设计中的扇形陷阱(Fan Traps)和断层陷阱(Chasm Traps) 简单并发控制
使用System.Web.Mail发送Mail的错误解决方案
Brendan · 2006-07-14 · via 博客园 - Brendan

        在ASP.NET 1.1上面发送Mail,使用的是System.Web.Mail命名空间,而使用的是STMP Server进行发送。代码非常简单,下面是一个SendMail函数,它接收一封邮件需要的各个要素,然后使用SmtpMail.Send方法发送邮件。

 1 public static void SendMail(string to, string from, string subject, string body, string smtpServer)
 2 {
 3     MailMessage message = new MailMessage();
 4     message.To = to;
 5     message.From = from;
 6     message.Subject = subject;
 7     message.Body = body;
 8 
 9     try
10     {
11         SmtpMail.SmtpServer = smtpServer;
12         SmtpMail.Send(message);
13     }
14     catch(Exception e)
15     {
16     }
17 }

        写这篇文章不是为了说明怎么使用这个函数,因为这个在MSDN上写得已经非常清楚。这个函数用起来看似简单,实际上暗藏玄机。如果你不作任何设置就使用如下的方法来发送mail,你立即会的到一个错误信息:

1 SendMail("sjphappy@126.com""sjphappy@126.com""test""test""127.0.0.1");

错误信息说:"could not access 'CDO.Message' Object"。收到这样的消息,你要做到第一件事就是去查看innerexception的内容,然后根据它来做处理。

如果innerexception='

Exception has been thrown by the target of an invocation',那么你就应该尝试打开inetmgr,到右击"默认SMTP虚拟服务器"->"属性"->"访问"->"中继",然后加入127.0.0.1这个地址就可以解决问题。

如果需要更多这方面的帮助,请访问http://www.systemwebmail.com/