最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp各种发送邮件功能代码
时间:2022-06-30 11:33:11 编辑:袖梨 来源:一聚教程网
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
相关文章
- 无限暖暖搭乘大鸟巴士怎么玩 公测第三天每日任务做法介绍 12-27
- 奇迹暖暖绚光护佑搭配攻略 奇迹暖暖绚光护佑过关攻略 12-27
- 绝区零月城柳意像影画怎么样 12-27
- 无限暖暖翩翩愿飞去怎么样 12-27
- 黑神话悟空1.0.12.16581版本更新公告 12-27
- 光遇12.27红石碎片在哪里 12-27