function NetWork_Class() {
this.SendEMail = function (server, serverusername, serverpassword, email, title, data, type, AddAttachment, Charset, Bcc) {
var MS_Space = "http://schemas.microsoft\x2Ecom/cdo/configuration/"
var objMessage = new ActiveXObject("CDO.Message")
var Fields = objMessage.Configuration.Fields
Fields.Item(MS_Space + "sendusing") = 2
Fields.Item(MS_Space + "smtpserver") = server || ("smtp." + serverusername.slice(serverusername.indexOf("@") + 1))
Fields.Item(MS_Space + "smtpserverport") = 25
Fields.Item(MS_Space + "smtpconnectiontimeout") = 20
Fields.Item(MS_Space + "smtpauthenticate") = 1
Fields.Item(MS_Space + "sendusername") = serverusername
Fields.Item(MS_Space + "sendpassword") = serverpassword
Fields.Update()
objMessage.To = email //接收者的邮件地址
objMessage.From = serverusername //发送人的邮件地址
objMessage.Subject = title //标题
if (type && type.toUpperCase() == "HTML") {
objMessage.HtmlBody = data //html正文
} else {
objMessage.TextBody = data //文本正文
}
if (Charset) {
objMessage.HTMLBodyPart.Charset = Charset
objMessage.BodyPart.Charset = Charset
}
if (Bcc) objMessage.Bcc = Bcc //抄送
if (AddAttachment) objMessage.AddAttachment(AddAttachment)//邮件附件
objMessage.Send()
return true
}
}