代码如下:
DirectoryInfo   Dir=new   DirectoryInfo(@"D:\AA);
foreach(FileInfo   f   in   Dir.GetFiles("*.*"))      //查找文件
{
      Configuration conf=new ConfigurationClass();  
      conf.Fields[CdoConfiguration.cdoSendUsingMethod].Value=CdoSendUsing.cdoSendUsingPort;  
      conf.Fields[CdoConfiguration.cdoSMTPServer].Value="111.111.111.111"; 
      conf.Fields[CdoConfiguration.cdoSMTPServerPort].Value=25; 
      conf.Fields[CdoConfiguration.cdoSMTPAuthenticate].Value=CdoProtocolsAuthentication.cdoBasic; 
      conf.Fields[CdoConfiguration.cdoSendUserName].Value="username";  
      conf.Fields[CdoConfiguration.cdoSendPassword].Value="password";   conf.Fields.Update();  
MessageClass msg=new MessageClass();  
msg.Configuration=conf;  
msg.Charset="Utf-8";
msg.To="[email protected]";
msg.CC="[email protected]";
        msg.Subject="test";  
msg.AddAttachment(@"D:\AA"+@"\\"+f.ToString(),"","");
msg.From="[email protected]";  
msg.Send();
}邮件是能发出去的,附件也有,可是发的附件总是坏的(.txt文件是可以打开的,晕啊),在我机器里的文件是好的能打开
VS:2002