Mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1")
请问这句是什么意思,起什么作用?

解决方案 »

  1.   

    MyMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
    MyMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", txtUserName);
    MyMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", txtPassword); 给需验证的smtp服务器传递用户名和密码
      

  2.   

    MyMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
     这句是什么意思?为什么是 1 ?
      

  3.   

    private void Page_Load(object sender, System.EventArgs e) 

    MailMessage mail = new MailMessage(); 
    mail.To = "[email protected]"; 
    mail.From = "[email protected]"; 
    mail.Subject = "this is a test email."; 
    mail.Body = "Some text goes here"; 
    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication 
    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "my_username_here");  //set your username here 
    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "super_secret");  //set your password here SmtpMail.SmtpServer = "mail.mycompany.com"; //your real server goes here 
    SmtpMail.Send( mail ); 
    }