<%
'=================================================
' 发送邮件组件:
' Edit By YangZheng
' Write By R.W. 2005年1月24日 星期一
'=================================================
Dim SmtpSys(5)
if IsArray(Application("smtpSys")) then
SmtpSys(0) = Application("smtpSys")(0) '邮件服务器
SmtpSys(1) = Application("smtpSys")(3) '电子邮件地址
SmtpSys(2) = Application("smtpSys")(1) '用户名
SmtpSys(3) = Application("smtpSys")(2) '密码
SmtpSys(4) = Application("smtpSys")(4) '发送组件
else
Response.Clear()
Response.charset="gb2312"
Response.Write("获取邮件发送参数失败,请先设置好邮件服务器参数!")
Response.End
end if
SmtpSys(5) = Request.ServerVariables("SERVER_NAME")
Function Jmail(Email,Topic,Mailbody)
On Error Resume Next
Dim Mail
Set Mail = Server.CreateObject("JMail.Message")
Mail.silent=true
Mail.Logging = True
Mail.Charset = "gb2312"
If Not(SmtpSys(2) = "" Or SmtpSys(3) = "") Then
Mail.MailServerUserName = SmtpSys(2) '您的邮件服务器登录名
Mail.MailServerPassword = SmtpSys(3) '登录密码
End If
Mail.ContentType = "text/html"
Mail.Priority = 1
Mail.From = SmtpSys(1)
Mail.FromName = SmtpSys(5)
Mail.AddRecipient Email
Mail.Subject = Topic
Mail.Body = Mailbody
Mail.Send (SmtpSys(0))
Set Mail = Nothing
Jmail = true
If Err Then Jmail = false
End Function
Function Cdonts(Email,Topic,Mailbody)
On Error Resume Next
Dim ObjCDOMail
Set ObjCDOMail = Server.CreateObject("CDONTS.NewMail")
ObjCDOMail.From = SmtpSys(1)
ObjCDOMail.To = Email
ObjCDOMail.Subject = Topic
ObjCDOMail.BodyFormat = 0
ObjCDOMail.MailFormat = 0
ObjCDOMail.Body = Mailbody
ObjCDOMail.Send
Set ObjCDOMail = Nothing
Cdonts = true
If Err Then Cdonts = false
End Function
Function Aspemail(Email,Topic,Mailbody)
On Error Resume Next
Dim Mailer
Set Mailer = Server.CreateObject("Persits.MailSender")
Mailer.Charset = "gb2312"
Mailer.IsHTML = True
Mailer.username = SmtpSys(2) '服务器上有效的用户名
Mailer.password = SmtpSys(3) '服务器上有效的密码
Mailer.Priority = 1
Mailer.Host = SmtpSys(0)
Mailer.Port = 25 ' 该项可选.端口25是默认值
Mailer.From = SmtpSys(1)
Mailer.FromName = SmtpSys(5) ' 该项可选
Mailer.AddAddress Email,Email
Mailer.Subject = Topic
Mailer.Body = Mailbody
Mailer.Send
Aspemail = true
If Err Then Aspemail = false
End Function
Function EasyMail(Email,Topic,Mailbody)
On Error Resume Next
Dim mailsend
Set mailsend = Server.CreateObject("easymail.MailSend")
mailsend.CreateNew SmtpSys(1),SmtpSys(3)
mailsend.MailName = SmtpSys(5) '发信人名称
mailsend.EM_To = Email '收件人邮件地址
'mailsend.EM_BackAddress = '回复电子邮件地址
'mailsend.EM_Bcc '密送
'mailsend.EM_Cc '抄送
mailsend.EM_Subject = Topic '邮件主题"
mailsend.EM_HTML_Text = Mailbody
mailsend.useRichEditer = true
'mailsend.EM_ReadBack = true '阅读确认
'mailsend.EM_Priority = '优先级
mailsend.send
set mailsend=nothing
EasyMail = true
If Err Then EasyMail = false
End Function
%>