WEB开发网
开发学院网页设计JavaScript 使用Javascript实现电子邮件群发功能 阅读

使用Javascript实现电子邮件群发功能

 2010-09-14 13:37:47 来源:WEB开发网   
核心提示: //发送邮件的主函数function DosendMail(mailAddressList){$('clientShowDo').innerHTML=''var result = false;try{var objMail = new ActiveXObje

//发送邮件的主函数

function DosendMail(mailAddressList)
{
$('clientShowDo').innerHTML=''
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" );
  
 mailAddressList = mailAddressList.replace(new RegExp(" ","gm"),"");  //去除邮件地址中可能存在的空格
  
 objMail.Logging = true;
 objMail.Charset = "GB2312";
 objMail.Priority = 3;
 objMail.ContentType = "text/html";
 
 objMail.From = getValueById('sys_emailAddress'); 
 objMail.FromName = "你的称呼";
 objMail.AddRecipient( mailAddressList );
 objMail.Subject = subject;
 objMail.Body = body;
  
 objMail.MailServerUserName = getValueById('sys_username'); 
 objMail.MailServerPassword = getValueById('sys_password');
 var sys_StmpAddr = getValueById('sys_Smtp');
 
 objMail.Send( sys_StmpAddr );
  
 result = true;
 setTimeout("1200",$('clientShowDo').innerHTML='OK');
 $('clientShowSuccess').innerHTML = parseInt($('clientShowSuccess').innerHTML) + 1 ; //显示已经发送成功的条数
  
  //SetDefaultValue('0'); //清空默认的设置
}
catch ( e )
{
 //alert( e.description );
 //alert( objMail.Log );
 $('clientShowFail').innerHTML = parseInt($('clientShowFail').innerHTML) + 1 ; //错误数加1
 $('clientShowFailList').innerHTML = $('clientShowFailList').innerHTML + "<br>" + mailAddressList ; //追加到错误列表
 $('clientShowFailDescrip').innerHTML = $('clientShowFailDescrip').innerHTML + "<hr>" + objMail.Log //显示详细的错误信息
}
  
return result;
}
  
</script>

上一页  1 2 3 

Tags:使用 Javascript 实现

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接