I have some code which sends emails out with an attachment.
sch = "http://schemas.microsoft.com/cdo/configuration/"
Set cdoConfig = CreateObject("CDO.Configuration")
Set cdoMessage = CreateObject ("CDO.Message")
With cdoMessage
Set .Configuration = cdoConfig
.From = strEmail
.To = "address removed"
.Subject = "subject email"
strMessageBody = "<h2>Message</h2>"
.HTMLBody = strMessageBody
.AddAttachment (strFile)
.Send
End With
Code works fine for attachments ending ".doc", ".xls" ".ppt", ".zip"
As soon as any "none standard" extensions are used, for example say ".msg" I get开发者_如何学Go an error message:
"CDO.Message.1 error '80040218'
Unknown Error "
Any ideas or workarounds?
I've had problems sending attachments before using CDO. I solved my problems by specifing the correct encoding mechanism. You might need to do some experimentation. I successfully attach .pdf, .doc, .xls, .ppt files via asp classic and CDO.Message
e.g.
myMail.BodyPart.ContentTransferEncoding = "8bit"
Reference available here
精彩评论