<%
Sub sendemail(sendFrom,sendTO,smtpserver,sendusername,sendpassword,subject,message)
On Error Resume Next
set iConfg = CreateObject("CDO.Configuration")
Set oFields = iConfg.Fields
'oFields = iConfg.Fields
oFields.item("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
oFields.item("http://schemas.microsoft.com/cdo/configuration/sendemailaddress")=sendFrom //sender mail
oFields.item("http://schemas.microsoft.com/cdo/configuration/smtpaccountname")=sendFrom //email account
oFields.item("http://schemas.microsoft.com/cdo/configuration/sendusername")=sendusername
oFields.item("http://schemas.microsoft.com/cdo/configuration/sendpassword")=sendpassword
oFields.item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")=1
'value=0 代表Anonymous验证方式（不需要验证）
'value=1 代表Basic验证方式（使用basic (clear-text) authentication. 
'The configuration sendusername/sendpassword or postusername/postpassword fields are used to specify credentials.）
'Value=2 代表NTLM验证方式（Secure Password Authentication in Microsoft Outlook Express）
oFields.item("http://schemas.microsoft.com/cdo/configuration/languagecode")=&H0804
oFields.item("http://schemas.microsoft.com/cdo/configuration/smtpserver")=smtpserver
oFields.Update()
				
Set oMsg = Server.CreateObject("CDO.Message")
Set oMsg.Configuration = iConfg
oMsg.From = sendFrom
oMsg.To = sendTO
oMsg.Subject = subject
oMsg.HTMLBody = message
'set iConfg=CreateObject("CDO.IConfiguration")
'iConfg = oMsg.Configuration
'set oFields=CreateObject("ADODB.Fields")
'set iMsg = CreateObject("CDO.Message")
'oMsg.BodyPart.Charset="gb2312"
'oMsg.HTMLBodyPart.Charset="gb2312"
oMsg.Send()
if err.number<>0 then
		Response.write "<center>邮件发送失败，请与管理员联系！</center>" 
		'response.end
end if
End Sub	

Sub SendJmail(sendFrom,sendTO,smtpserver,sendusername,sendpassword,subject,message,SendName)
On Error Resume Next
Set JMail=Server.CreateObject("JMail.Message")
JMail.Charset="gb2312"
JMail.ContentType = "text/html"
jmail.from = SendFrom
jmail.silent = true
jmail.Logging = true
jmail.FromName = SendName
jmail.mailserverusername = sendusername
jmail.mailserverpassword = sendpassword
jmail.AddRecipient sendTO
jmail.body=message
JMail.Subject=subject
if not jmail.Send ( smtpserver ) then
SendMail="<center><li>由于系统后台没有设置好邮件发送系统，给您发送的注册信息未成功！</li></center>"
else
SendMail="<center><li>给您发送的注册信息成功！</li></center>"
end if
response.Write SendMail
End Sub
%>


