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 |