为什么我写的程序只能发送126的
string getEmail = "SELECT Email FROM QqjyPeoUser WHERE UserName = '"+ userName +"'";string emailAddress = Convert.ToString(Database.ExecuteScalar(getEmail));
string password = PkClass.RandCode(8);
jmail.Message Jmail = new jmail.Message();
DateTime t = DateTime.Now;
String Subject = "" + comName + "用户重设密码";
String body = "尊敬的用户你好:</br> 你的用户名:" + userName + " </br> 密码:" + password + " </br> 你的Email:" + emailAddress + " </br> 为确保你的密码安全 请及时修改密码:<a href=" + comUrl + " >" + comUrl + "</a></br>";
String FromEmail = comEmail;
String ToEmail = emailAddress;
//Silent属性:如果设置为true,JMail不会抛出例外错误. JMail. Send( () 会根据操作结果返回true或false
Jmail.Silent = true;
//Jmail创建的日志,前提loging属性设置为true
Jmail.Logging = true;
//字符集,缺省为"US-ASCII"
Jmail.Charset = "GB2312";
//信件的contentype. 缺省是"text/plain") : 字符串如果你以HTML格式发送邮件, 改为"text/html"即可。
Jmail.ContentType = "text/html";
//添加收件人
Jmail.AddRecipient(ToEmail,userName,"");
Jmail.From = FromEmail;
//发件人邮件用户名
Jmail.MailServerUserName = comEmail;
//发件人邮件密码
Jmail.MailServerPassWord = comPassword;
//设置邮件标题
Jmail.Subject = Subject;
//邮件添加附件,(多附件的话,可以再加一条Jmail.AddAttachment( "c:\\test.jpg",true,null);)。加了附件,讲把上面的Jmail.ContentType="text/html";删掉。否则会在邮件里出现乱码。
//Jmail.AddAttachment("c:\\test.jpg", true, null);
//邮件内容
Jmail.Body = body + t.ToString();
//Jmail发送的方法
Jmail.Send("smtp.sina.com", false);
string UserPswValue = FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5");
Database.ExecuteSql("update QqjyPeoUser set UserPsw='" + UserPswValue + "' where UserName='" + userName + "' ");
Jmail.Close();