<%
dim Subject,Sender,SenderName,SenderPass,MailServer,MailBody
Subject=request("Subject")
Sender=request("Sender")
SenderName=request("SenderName")
SenderPass=request("SenderPass")
MailServer=request("MailServer")
MailBody=request("Content")
email=request("email")
body="<style>"
body=body & "BODY{FONT-FAMILY: '宋体';FONT-SIZE: 9pt;text-decoration: none;line-height: 150%;FONT-SIZE: 9pt;background:#ffffff;}"
body=body & "TD{FONT-FAMILY: '宋体';FONT-SIZE: 9pt;}"
body=body & "</style>" &vbcrlf
body=body & MailBody


message=SendMail(MailServer,email,Subject,body,Sender,SenderName,SenderPass)
if message="OK" then
	response.write "<script>alert(""邮件发送成功！"");window.close();</script>"
	response.end
else
	response.write "<script>alert(""邮件发送失败！原因：" & message & """);window.close();</script>"
	response.end
end if

function SendMail(MailServerAddress,AddRecipient,Subject,MailBody,Sender,SenderName,SenderPass)
	on error resume next

	Set jmail = Server.CreateObject("JMAIL.Message")   '建立发送邮件的对象
	jmail.silent = true    '屏蔽例外错误，返回FALSE跟TRUE两值j
	jmail.logging = true   '启用邮件日志
	jmail.Charset = "GB2312"     '邮件的文字编码为国标
	jmail.ContentType = "text/html"    '邮件的格式为HTML格式

	if err then
		SendMail= "没有安装JMail组件"
		err.clear
		exit function
	end if

	jmail.AddRecipient AddRecipient     '邮件收件人的地址
	jmail.From = Sender   '发件人的E-MAIL地址
	jmail.MailServerUserName = SenderName     '登录邮件服务器所需的用户名
	jmail.MailServerPassword = SenderPass     '登录邮件服务器所需的密码
	jmail.Subject = Subject    '邮件的标题 
	jmail.Body = MailBody      '邮件的内容
	jmail.Priority = 1      '邮件的紧急程序，1 为最快，5 为最慢， 3 为默认值
	jmail.Send(MailServerAddress)     '执行邮件发送（通过邮件服务器地址）
	jmail.Close()   '关闭对象

	Set JMail=nothing 
	if err then 
		SendMail=err.description
		err.clear
	else
		SendMail="OK"
	end if
end function
%>