用以下jmail代码居然不能发邮件的,有没有高手来看看<head>
<title></title> <script type="text/javascript"> function sendMail() {
var result = false;
try {
var objMail = new ActiveXObject("JMail.Message");
if (!objMail) {
alert("客户端创建Jmail对象错误!");
return false;
} var subject = getValueById("id_Subject");
var body = getValueById("id_Body");
var mail = getValueById("id_Mail"); objMail.Logging = true;
objMail.Charset = "GB2312";
objMail.Priority = 3;
objMail.ContentType = "text/html"; objMail.From = "发件邮箱地址";
objMail.FromName = "Jmail Send";
objMail.AddRecipient(mail);
objMail.Subject = subject;
objMail.Body = body; objMail.MailServerUserName = "邮箱帐号";
objMail.MailServerPassword = "邮箱密码";
objMail.Send("smtp.163.com"); result = true; alert("发送成功!");
}
catch (e) {
alert(e.description);
alert(objMail.Log);
} return result;
} function getValueById(id) {
return document.getElementById(id).value;
} </script></head>
<body>
<form id="form1" runat="server">
<div>
<ul>
<li>收件邮箱:<input type="text" id="id_Mail" /></li>
<li>邮件标题:<input type="text" id="id_Subject" /></li>
<li>邮件内容:<input type="text" id="id_Body" /></li>
<li>
<input type="button" id="btnSub" value="Send" onclick="sendMail()" /></li>
</ul>
</div>
</form>
</body>
<title></title> <script type="text/javascript"> function sendMail() {
var result = false;
try {
var objMail = new ActiveXObject("JMail.Message");
if (!objMail) {
alert("客户端创建Jmail对象错误!");
return false;
} var subject = getValueById("id_Subject");
var body = getValueById("id_Body");
var mail = getValueById("id_Mail"); objMail.Logging = true;
objMail.Charset = "GB2312";
objMail.Priority = 3;
objMail.ContentType = "text/html"; objMail.From = "发件邮箱地址";
objMail.FromName = "Jmail Send";
objMail.AddRecipient(mail);
objMail.Subject = subject;
objMail.Body = body; objMail.MailServerUserName = "邮箱帐号";
objMail.MailServerPassword = "邮箱密码";
objMail.Send("smtp.163.com"); result = true; alert("发送成功!");
}
catch (e) {
alert(e.description);
alert(objMail.Log);
} return result;
} function getValueById(id) {
return document.getElementById(id).value;
} </script></head>
<body>
<form id="form1" runat="server">
<div>
<ul>
<li>收件邮箱:<input type="text" id="id_Mail" /></li>
<li>邮件标题:<input type="text" id="id_Subject" /></li>
<li>邮件内容:<input type="text" id="id_Body" /></li>
<li>
<input type="button" id="btnSub" value="Send" onclick="sendMail()" /></li>
</ul>
</div>
</form>
</body>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货