日期:2014-05-19  浏览次数:21084 次

在2003下使用.net System.Web.Mail中的方法发送邮件,为什么在有的机器上好用,有的机器上不好用
测试的机器都是win2003,都安装了outlook客户端,在有的机器上报“未能访问CDO.Message对象”错误

以下是代码
MailMessage   message   =   new   MailMessage();
message.From   =   SenderAddress;
message.Fields[ "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate "]   =   "1 ";
message.Fields[ "http://schemas.microsoft.com/cdo/configuration/sendusername "]   =   SendUserName;
message.Fields[ "http://schemas.microsoft.com/cdo/configuration/sendpassword "]   =   SendUserPassWord;
message.To   =   config.SendAddress;
message.BodyEncoding   =   Encoding.UTF8;
message.Body   =   " ";
message.Subject   =   Path.GetFileNameWithoutExtension(fileFullName);
MailAttachment   attachment   =   new   MailAttachment(fileFullName);
message.Attachments.Add(attachment);
SmtpMail.SmtpServer   =   SmtpServerName;
SmtpMail.Send(message);

------解决方案--------------------
http://blog.joycode.com/ghj/archive/2004/10/22/36274.aspx