public void CDOsendMail()
{
try
{
CDO.Message oMsg = new CDO.Message();
 
oMsg.From = "[email protected]";
oMsg.To = "[email protected]";
oMsg.Subject = "MailTest";
   
oMsg.HTMLBody = "<html><body>Test</body></html>"; CDO.IConfiguration iConfg = oMsg.Configuration;
ADODB.Fields oFields = iConfg.Fields;

oFields["http://schemas.microsoft.com/cdo/configuration/sendusing"].Value=2;
oFields["http://schemas.microsoft.com/cdo/configuration/sendemailaddress"].Value="[email protected]"; //sender mail
oFields["http://schemas.microsoft.com/cdo/configuration/smtpaccountname"].Value="[email protected]"; //email account
oFields["http://schemas.microsoft.com/cdo/configuration/sendusername"].Value="username";
oFields["http://schemas.microsoft.com/cdo/configuration/sendpassword"].Value="password";
oFields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"].Value=1;
//value=0 Anonymous
//value=1 Basic
//The configuration sendusername/sendpassword or postusername/postpassword fields are used to specify credentials.)
//Value=2 NTLM(Secure Password Authentication in Microsoft Outlook Express)
oFields["http://schemas.microsoft.com/cdo/configuration/languagecode"].Value=0x0804;
oFields["http://schemas.microsoft.com/cdo/configuration/smtpserver"].Value="smtp.21cn.com"; oFields.Update();
oMsg.BodyPart.Charset="gb2312";
oMsg.HTMLBodyPart.Charset="gb2312";  oMsg.Send();
oMsg = null;
}
catch (Exception e)
{
throw e;
}
}
----------
主要是下面的配置用途不清楚,他是用来干什么的?那个用户名和密码是指什么
oFields["http://schemas.microsoft.com/cdo/configuration/sendemailaddress"].Value="[email protected]"; //sender mail
oFields["http://schemas.microsoft.com/cdo/configuration/smtpaccountname"].Value="[email protected]"; //email account
oFields["http://schemas.microsoft.com/cdo/configuration/sendusername"].Value="username";
oFields["http://schemas.microsoft.com/cdo/configuration/sendpassword"].Value="password";