要是smtp:
MailObj.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); 
MailObj.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", username); 
MailObj.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", userpassword);

解决方案 »

  1.   

    CDO:
    http://www.cnblogs.com/mist/archive/2004/06/28/19299.aspx
    SMTP:
    //进行SMTP验证
    if(ESmtp)
    {
    SendBuffer=new String[4];
    SendBuffer[0]="EHLO " + mailserver + enter;
    SendBuffer[1]="AUTH LOGIN" + enter;
    SendBuffer[2]=Base64Encode(username) + enter;
    SendBuffer[3]=Base64Encode(password) + enter;
    if(!Dialog(SendBuffer,"SMTP服务器验证失败,请核对用户名和密码。"))
    return false;
    }
    else
    {
    SendBufferstr="HELO " + mailserver + enter;
    if(!Dialog(SendBufferstr,""))
    return false;
    }
      

  2.   

    我做过ESMTP的,就是扩展SMTP,加了用户身份验证的。上面的朋友给了代码了。根据协议,第一步发送EHLO或HELLO,接受到正确返回信息可以发第二个命令AUTH LOGIN,告诉服务器要进行身份验证了,然后把用户名和密码经过BASE64编码发送给服务器,最后发送数据就OK了。
    另外服务器返回信息可以不处理,但这样做弊端很大。
      

  3.   

    http://community.csdn.net/Expert/topic/3339/3339725.xml?temp=.8403589