ASP.NET jmial 电子邮件的发送
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
sendMail("陈建勇", "chenjianyong@126.com", "chen@126.com", "发个邮件试试", "你能收到,说明是你自己发的");
}
/// <summary>
/// 发送电子邮件 引用jmail 组件
/// </summary>
/// <param name="sender"> 发件人 </param>
/// <param name="senderMail"> 发件人电子邮件 </param>
/// <param name="receiver"> 收件人电子邮件 </param>
/// <param name="subject">主题 </param>
/// <param name="content"> 邮件内容 </param>
public void sendMail(string sender, string senderMail, string receiver, string subject, string content)
{
jmail.MessageClass jmMessage = new jmail.MessageClass();
// 设置字符集
jmMessage.Charset = "gb2312";
//设置邮件内容形式
jmMessage.ContentType = "text/html";
// 发件人邮箱地址
jmMessage.from = senderMail;
// 发件人姓名
jmMessage.fromName = sender;
// 设置主题
jmMessage.Subject = subject;
// 设置内容
相关文档:
准备工作和WinForm程序中应用的差不多:
1.首先下载jmail控件,然后安装(其实不安装也行,只要你能找到jmail.dll文件,然后注册该dll文件。这里不支持上传附件,否则我就把我下载的传上来了),附上手工注册它的批处理:
echo off
copy jmail.dll C:\windows\system32
regsvr32 ......
ASP.NET清除页面缓存
(1) Response.Buffer = true;
Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1);
Res ......
自从IE6 SP1起 , 这个浏览器就支持cookie的httpOnly属性.
这个属性, 告诉浏览器, 使用 window.document.cookie 不允许访问该cookie .
而在ASP.NET2.0中 , 这个属性也得到了支持, 并且在FormAuthentication中指定该属性.
但是,FireFox等浏览器, 并不支持该属性. 那么这个带来什么后果?
例如 , 假如你用FireFox登录博客 ......
If you come to ASP.NET MVC from a purely ASP.NET Web Forms background, one of the first things you are likely to notice is that all those nice easy Server Controls have disappeared. One of those is the FileUpload, and its absence seems to cause a few problems. This article looks at how to upload f ......