<%
dim Subject,Sender,SenderName,SenderPass,MailServer,MailBody

SenderName="info@nanyangren.com"
SenderPass="123456"
MailServer="mail.nanyangren.com"


email="test@163.com"        '收件人邮箱
myEmail=request("email")
Sender="info@nanyangren.com"         '发件人邮箱

rootCId=request("rootCId")      '主题
If rootCId="" Or Not IsNumeric(rootCId) Then rootCId=1
Select Case CInt(rootCId)
	Case 1
		Subject=my_name&"--服务或者功能有问题"
	Case 2
		Subject=my_name&"--建议或者问题咨询"
	Case Else
		Subject=my_name&"--服务或者功能有问题"
End select
content=request("content")           '内容

MailBody=Replace(content,vbcrlf,"<BR>")

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
body=body & "<BR>我的邮箱："&myEmail

message=SendMail(MailServer,email,Subject,body,Sender,SenderName,SenderPass)
if message="OK" then
	response.write "<script>alert(""邮件发送成功！"");location.href='question.asp';</script>"
	response.end
else
	response.write "<script>alert(""邮件发送失败！原因：" & message & """);history.go(-1);</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
%>
