将jmail dll文件添加到项目中,然后在head中添加如下脚本函数就ok
/*
**infor: 要发送的邮件信息
**subject: 要发送的邮件主题
*/
function SendEMail(infor, subject)
{
var jMail = new ActiveXObject("Jmail.message");
jMail.Silent = true;
jMail.Charset = "gb2312";
jMail.FromName = "sender" //发件人
jMail.From = " sender@ "; //发送人的邮件地址
jMail.AddRecipient(" accepter@ "); //收件人的邮件地址
jMail.Subject = subject;
jMail.Body = infor;
jMail.MailServerUserName="发件人邮箱登陆名";
jMail.MailServerPassWord="发件人邮箱登陆密码";
var ret = jMail.Send("smtp.");
if(ret == false)
{
alert("fail");
}
else
{
alert("success");
}
jMail.Close();
}