杨的空间
业精于勤,荒于嬉,行成于思,毁于随

 

         using System.Web.Mail; 
         MailMessage mail 
= new MailMessage(); 
       mail.To 
= "me@mycompany.com"
       mail.From 
= "you@yourcompany.com"
       mail.Subject 
= "this is a test email."
       mail.Body 
= "Some text goes here"
          mail.BodyFormat 
= MailFormat.Html;//设置为HTML格式  
         
//设置为需要用户验证 
      mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate""1");   
         
//设置验证用户名(把my_username_here改为你的验证用户名) 
      mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername""my_username_here");  
         
//设置验证密码(把password改为你的验证密码) 
      mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword""password");   
      SmtpMail.SmtpServer 
= "mail.mycompany.com";  //邮件服务器地址 
      SmtpMail.Send( mail ); 



主要是在mail.Fields里Add三个设置就可以了

posted on 2006-02-18 10:38 阅读(469) 评论(0)  编辑 收藏 引用 所属分类: 技术类
只有注册用户登录后才能发表评论。