According to [email protected] (Bill Cheng (MS))Currently there is no way to specify properties for authentication with the SmtpMail namespace. Try a third party component: http://www.SmtpDotNet.com/see
http://groups.google.com/groups?selm=ip2oydMICHA.1956%40cpmsftngxa07&oe=UTF-8&output=gplain

解决方案 »

  1.   

    .net文档里有写这个
    不过我是没有通过
      

  2.   

    我给你一段我用来发送邮件的代码:
    CDO.Message oMsg = new CDO.Message();
    oMsg.From = FromTextBox.Text ;
    oMsg.To = ToTextBox.Text ;
    oMsg.Subject = SubjectTextBox.Text ;
    oMsg.TextBody = MessageTextBox.Text ;
    oMsg.CC=CCTextBox.Text ;
    oMsg.BCC=BCCTextBox.Text ;
    string UserName;
    string[] username=new String[100];
    for(int i=0;i<FromTextBox.Text.Length;i++)
    {
    if(FromTextBox.Text[i].ToString()!="@")
    {
    username[i]=FromTextBox.Text[i].ToString();
    continue;
    }
    else
    break;
    }
    UserName=String.Concat(username);

    CDO.IConfiguration iConfg;  
    ADODB.Fields oFields;
    iConfg = oMsg.Configuration;  
    oFields = iConfg.Fields; oFields["http://schemas.microsoft.com/cdo/configuration/sendusing"].Value=2; 
    oFields["http://schemas.microsoft.com/cdo/configuration/sendemailaddress"].Value=FromTextBox.Text.ToString() ; 
    oFields["http://schemas.microsoft.com/cdo/configuration/smtpuserreplyemailaddress"].Value=FromTextBox.Text.ToString() ;
    oFields["http://schemas.microsoft.com/cdo/configuration/smtpaccountname"].Value=UserName; 
    oFields["http://schemas.microsoft.com/cdo/configuration/sendusername"].Value=UserName;
    oFields["http://schemas.microsoft.com/cdo/configuration/sendpassword"].Value=PasswordTextBox.Text.ToString();
    oFields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"].Value=1; 
    oFields["http://schemas.microsoft.com/cdo/configuration/smtpserver"].Value="online.sh.cn"; 
    oFields.Update(); try
    {
    oMsg.Send();
    oMsg = null;
    MessageBox.Show("邮件发送成功!");
    }
    catch (Exception ex)
    {
    MessageBox.Show("邮件发送不成功!");
    }