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

推荐订阅源

雷峰网
雷峰网
G
Google Developers Blog
Blog — PlanetScale
Blog — PlanetScale
P
Proofpoint News Feed
博客园 - Franky
L
LangChain Blog
GbyAI
GbyAI
A
About on SuperTechFans
MongoDB | Blog
MongoDB | Blog
F
Fortinet All Blogs
Y
Y Combinator Blog
Stack Overflow Blog
Stack Overflow Blog
博客园 - 叶小钗
N
Netflix TechBlog - Medium
D
DataBreaches.Net
Martin Fowler
Martin Fowler
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
爱范儿
爱范儿
罗磊的独立博客
H
Help Net Security
云风的 BLOG
云风的 BLOG
C
Check Point Blog

博客园 - 井泉

http多线程下载断点续传 抓屏(转) 投票程序2 图像识别 Using The Office 2007 OCR Component in C# 投票程序 - 井泉 - 博客园 httptunnel (转)使用VS.Net IDE调试JavaScript WebBrowser页面与WinForm交互技巧 ICallbackEventHandler实现无刷新回调 创建完全可编辑的 DataGrid [Oracle]对数据库字段使用默认值 VS2005中使用C#的新特性:可空类型 DataGrid/DataList,你会用了吗? 作者- heone 用ASP.NET建立一个在线RSS新闻聚合器 ASP.NET程序中常用的三十三种代码 Effective C# 在ASP.NET中实现AJAX 101代码示例 net2.0类库 C# 3.0语言详解之基本的语言增强 打印小结
如何通过需要验证的邮件服务器发送邮件?
井泉 · 2006-02-09 · via 博客园 - 井泉

在.NET Framework 推出以后,大家一直在为这个问题而伤脑筋。的确,在1.0的时候,我们是不能实现此方案的,大部分人选择了使用Socket底层自己重写。但是,在1.1的时候,其实Microsoft已经提供了验证功能了,只是一直没有公开。

恰好我在读.Text 0.95的源代码的时候找到了这段代码,感觉应该提供给大家咧嘴笑脸

private void Page_Load(object sender, System.EventArgs e)
{
       MailMessage mail = new MailMessage();
       mail.To = "me@mycompany.com";
       mail.From = "you@yourcompany.com";
       mail.Subject = "this is a test email.";
       mail.Body = "Some text goes here";
       mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication
       mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "my_username_here"); //set your username here
      mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "super_secret"); //set your password here

    SmtpMail.SmtpServer = "mail.mycompany.com";  //your real server goes here
    SmtpMail.Send( mail );
}

参考资料:

http://vaultpub.sourcegear.com/VaultService/VaultWeb/Blame.aspx?repid=7&path=$/Dottext/Dottext.Framework/Email/SystemMail.cs&version=1&includedversions=20 (用户名及密码为guest)

http://www.systemwebmail.com/faq/3.8.aspx