我用。NET自带的System.Net.Mail发邮件,在本地发送都好用,可是传到服务器上时,点发送确提示错误:
从客户端(ErrorMsg="发送邮件失败。<br>")中检测到有潜在危险的 Request.QueryString 值。我的代码如下:MailMessage mail = new MailMessage();
mail.From = new MailAddress("[email protected]");
mail.To.Add(new MailAddress("[email protected]"));
mail.Subject = txttaskName.Text;
mail.Body = "发送直告明细:<br><br>用户帐号:" + userName + "<br><br>时 间:" + txttaskTime.Text + "<br><br>直告属性:" + HiddenField1.Value+ "<br><br>发送数量:" + sendCount.Text + "<br><br>短信内容:" + txtSms.Text + "<br><br>体验号码:" + alertMdnStr.Text;
mail.IsBodyHtml = true;
SmtpClient client = new SmtpClient();
client.Send(mail);
从客户端(ErrorMsg="发送邮件失败。<br>")中检测到有潜在危险的 Request.QueryString 值。我的代码如下:MailMessage mail = new MailMessage();
mail.From = new MailAddress("[email protected]");
mail.To.Add(new MailAddress("[email protected]"));
mail.Subject = txttaskName.Text;
mail.Body = "发送直告明细:<br><br>用户帐号:" + userName + "<br><br>时 间:" + txttaskTime.Text + "<br><br>直告属性:" + HiddenField1.Value+ "<br><br>发送数量:" + sendCount.Text + "<br><br>短信内容:" + txtSms.Text + "<br><br>体验号码:" + alertMdnStr.Text;
mail.IsBodyHtml = true;
SmtpClient client = new SmtpClient();
client.Send(mail);
解决方案 »
- 要将一个CS工具软件重写为BS结构,有截图和功能说明,帮忙看看需要些什么知识?
- 在asp.net中获取复选框的值
- 数据绑定问题,在线等
- asp.net 网站发布时的问题,困扰nnn久了,哪位高手可以帮帮忙
- URL重写问题,提问
- [请教]DataView怎么取其中的某些行再组成一个dataview之类的东东?与吴旗娃分页控件的结合
- 我在Framework1.1和vs.net1.1里开发的一个WEB系统,现在布置在2.0的框架下可以运行吗?
- 已知一个文件是二进制的,如何把它写入记事本!
- 求救!help me,在线等待中......
- 怎样才能捕捉IE的BACK键的CLICK 事件?
- 在网页上如何实现rmvb文件的连续播放
- 小弟在线跪求高手得出现,再不搞出来要出人命得~高手快进来啊~
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="index.aspx.cs" Inherits="Team_index" [b]enableEventValidation="false"[/b] %>
===================
我在page里分别加了EnableEventValidation="false" ValidateRequest="false",可是还有这个错
2、发送邮件需要配置发送人邮件用户名和密码。
试一下吧。
{//.net2发送邮件
System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient("mail.giftour.com");
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential("[email protected]", "12345678"); //帐号密码
client.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
message.SubjectEncoding = System.Text.Encoding.UTF8;
message.BodyEncoding = System.Text.Encoding.UTF8;
message.From = new System.Net.Mail.MailAddress(MailFrom, "", System.Text.Encoding.UTF8);
message.To.Add(new System.Net.Mail.MailAddress(MailTo, "title", System.Text.Encoding.UTF8));
message.IsBodyHtml = false;
message.Subject = MailSubject;
message.Body = MailBody; try
{
client.Send(message);
return true;
}
catch (System.Net.Mail.SmtpException ex)
{
return false;
} }
<system.net>
<mailSettings>
<smtp from="[email protected]">
<network host="smtp.163.com" password="*****" port="25" userName="andy.lf"/>
</smtp>
</mailSettings>
</system.net>
我把要发送的内容里的<br>去掉了,可是还是说这个错误