ASP CDO发送邮件- Public Sub CDOMail(SmtpServer,FromMail,FromMailPass,ToMail,Title,Content)
- Dim NameSpace,Email
- Set Email = Server.CreateObject("CDO.Message")
- NameSpace = "https://schemas.microsoft.com/cdo/configuration/"
- With Email.Configuration.Fields
- .Item(NameSpace & "sendusing") = 2
- .Item(NameSpace & "smtpserver")= SmtpServer
- .Item(NameSpace & "smtpserverport") = 465
- .Item(NameSpace & "smtpusessl") = True
- .Item(NameSpace & "smtpconnectiontimeout") = 10
- .Item(NameSpace & "smtpauthenticate") = 1
- .Item(NameSpace & "sendusername") = FromMail
- .Item(NameSpace & "sendpassword") = FromMailPass
- .Update
- End With
- Email.From = FromMail
- Email.To = ToMail
- Email.Subject = Title
- Email.HtmlBody = Content
- Email.Send()
- Set Email = Nothing
- End Sub
复制代码 |