<%
Dim SendMail,cdoConfig

Sub Jmail(email,topic,mailbody)
	On Error Resume Next
	Dim JMail
	Set JMail=Server.CreateObject("JMail.Message")
	JMail.silent=True
	JMail.Logging=True
	JMail.Charset="gb2312"
	If Not(Newasp.MailUserName = "" Or Newasp.MailPassword = "") Then
		JMail.MailServerUserName = Newasp.MailUserName '您的邮件服务器登录名
		JMail.MailServerPassword = Newasp.MailPassword '登录密码
	End If
	JMail.ContentType = "text/html"
	JMail.Priority = 1
	JMail.From = Newasp.MailFrom  '邮件地址
	JMail.FromName = Newasp.SiteName  '网站名称
	JMail.AddRecipient email
	JMail.Subject = topic
	JMail.Body = mailbody
	If Err <> 0 Then
		'Response.Write "发送失败!原因：" & Err.Description
		SendMail="False"
	Else
		JMail.Send (Newasp.MailServer)   '发邮件服务器地址
		JMail.ClearRecipients()
		If Err <> 0 Then
			'Response.Write "发送失败!原因：" & Err.Description
			SendMail="False"
		Else
			SendMail="OK"
		End If
	End If
	Set JMail=nothing
End Sub

Sub Cdonts(email,topic,mailbody)
	On Error Resume Next
	Dim objCDOMail
	Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
	objCDOMail.From = Newasp.MailFrom  '邮件地址
	objCDOMail.To = email
	objCDOMail.Subject = topic
	objCDOMail.BodyFormat = 0 
	objCDOMail.MailFormat = 0 
	objCDOMail.Body = mailbody
	If Err <> 0 Then
		SendMail="False"
	Else
		objCDOMail.Send
		If Err <> 0 Then
			SendMail="False"
		Else
			SendMail="OK"
		End If
	End If
	Set objCDOMail = Nothing
End Sub

Sub aspemail(email,topic,mailbody)
	On Error Resume Next
	Dim Mailer
	Set Mailer=Server.CreateObject("Persits.MailSender") 
	Mailer.Charset = "gb2312"
	Mailer.IsHTML = True
	Mailer.username = Newasp.MailUserName	'服务器上有效的用户名
	Mailer.password = Newasp.MailPassword	'服务器上有效的密码
	Mailer.Priority = 1
	Mailer.Host = Newasp.setting(9)
	Mailer.Port = 25 ' 该项可选.端口25是默认值
	Mailer.From = Newasp.MailFrom   '邮件地址
	Mailer.FromName = Newasp.SiteName ' 该项可选
	Mailer.AddAddress email,email
	Mailer.Subject = topic
	Mailer.Body = mailbody
	If Err <> 0 Then
		SendMail="False"
	Else
		Mailer.Send
		If Err <> 0 Then
			SendMail="False"
		Else
			SendMail="OK"
		End If
	End If
	Set Mailer = Nothing
End Sub

Sub CDOMessage(Email,Topic,Mailbody)
	On Error Resume Next
	If Not IsObject(cdoConfig) Then
		Call CreatCDOConfig()
	End If
	Dim Obj
	Set Obj = Server.CreateObject("CDO.Message") 
	With Obj 
		Set .Configuration = cdoConfig 
		'.From = Newasp.MailFrom
		.To = Email
		.Subject = Topic 
		.TextBody = Mailbody
		.Send
	End With
	Set Obj = Nothing
	Set cdoConfig = Nothing
	If Err<>0 Then
		SendMail="False"
	Else
		SendMail="OK"
	End If
End Sub

Sub CreatCDOConfig()
	On Error Resume Next
	Dim Sch
	sch = "http://schemas.microsoft.com/cdo/configuration/"
	Set cdoConfig = Server.CreateObject("CDO.Configuration")
	With cdoConfig.Fields 
		.Item(sch & "smtpserver") = Newasp.MailServer		'--SMTP 服务器
		'.Item(sch & "smtpserverport") = 25
		.Item(sch & "sendusing") = 2
		.Item(sch & "smtpaccountname") = Newasp.SiteName
		.Item(sch & "sendemailaddress") = Newasp.MailFrom
		.Item(sch & "smtpuserreplyemailaddress") = 25
		'.Item(sch & "smtpauthenticate") = cdoBasic
		.Item(sch & "sendusername") = Newasp.MailUserName
		.Item(sch & "sendpassword") = Newasp.MailPassword
		.update 
	End With
	If Err<>0 Then
		SendMail="False"
	End If
End Sub
%>
