今天下午,在我吃完饭后终于解决了发送邮件的问题。一个字爽,在Blog中能学到好多啊,舒服。
把代码打上,以供参考
MailMessage mail = new MailMessage();
mail.To = "aaa@163.com";
mail.From = "bbb@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"); //就是1
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "aaa"); //你的用户名
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "xxx"); //你的密码
SmtpMail.SmtpServer = "smtp.163.com";
SmtpMail.Send( mail );
现在的都是ESTMP拉防止垃圾邮件了~所以你要 记住~
Add三个一定要写!~~~~