永无止境的程序

..::[......]::..

导航

用smtpmail通过需要认证的smtp服务器发信(C#)

MailMessage mail = new MailMessage();
 mail.To 
= "me@163.com";
 mail.From 
= "you@163.com";
 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""AlleNny"); //set your username here
 mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword""Password"); //set your password here
 SmtpMail.SmtpServer = "smtp.163.com";  //your real server goes here
 SmtpMail.Send( mail );

posted on 2005-01-15 23:16  AlleNny  阅读(664)  评论(0编辑  收藏  举报