嗯,最起码到目前为止还没有看到如此一个简单的只包括了三个类的命名空间就受到了这么多的争论,而这里甚至还有一个专题网站作为争论的总结: System.Web.Mail, OH MY! Complete FAQ for the System.Web.Mail namespace
而根本原因是FCL内置的发送邮件的方法还是用了Windows 2000的糟糕的CDO对象,而CDO在.NET之前就饱受批评,并且其问题依然存在,且不说乱码,突然当掉的问题都没解决。所以ASP的程序员们往往宁可满世界找第三方控件,也不愿意Win2K早已内置的CDO。
更要命的是MSDN对MailMessage类描述含糊,其关键的Fields属性居然就是“[待提供。]”
实际上我们正是需要通过这个属性发送需要SMTP身份验证的邮件:
MailMessage em = new MailMessage(); // basic authentication em.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); // set your username here em.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", username); // set your password here em.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", password); // ...
这个技巧也不知道从何而来,反正Scott Watermasysk在他的作品.Text里面的实现,成了我上面的例子 
|