Posted on 2008-06-14 20:44
疯狂水车 阅读(262)
评论(0) 编辑 收藏 引用 所属分类:
ASP技术文档
第一种
Dim objEmail
Set objEmail = Server.CreateObject("CDONTS.NewMail")
' objEmail.BodyFormat = 0 'CdoBodyFormatHTML
' objEmail.MailFormat = 0 'CdoMailFormatMime
objEmail.From = "abc@123.com"
objEmail.To = "abc@123.com"
objEmail.Cc = "abc@123.com"
objEmail.Subject = E_subject
objEmail.Body = E_body
objEmail.Send
Set objEmail = Nothing
第二种(推荐)
sch = "http://schemas.microsoft.com/cdo/configuration/"
Set MailConfig = CreateObject("CDO.Configuration")
strText ="xxxxxxxxxxxxxxxxxxxxxxxxxxx"
'strFile = "path\filename"
with MailConfig.fields
.item(sch & "sendusing").value = 2 'cdoSendUsingPort
.item(sch & "smtpserver").value = "smtp.xxxx.com"
.update
End With
Set Mail = CreateObject("CDO.Message")
Set Mail.Configuration = MailConfig
Mail.To = emailaddr
Mail.From = "anymail@xxxx.com"
Mail.Subject = "Subject" '
Mail.HTMLbody = strText
'Mail.AddAttachment strFile ' Attachment files
Mail.Bodypart.CharSet = "utf-8"
Mail.Send
Set Mail = Nothing