.addattachment 不适用于非标准文件扩展名
我有一些代码可以发送带有附件的电子邮件。
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
代码对于以“.doc”、“.xls”、“.ppt”、“.zip”结尾的附件工作正常
一旦使用任何“非标准”扩展名,例如“.msg”,我就会收到一条错误消息:
“ CDO.Message.1 错误“80040218”
未知错误“
有什么想法或解决方法吗?
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 an error message:
"CDO.Message.1 error '80040218'
Unknown Error "
Any ideas or workarounds?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在使用 CDO 之前,我在发送附件时遇到了问题。我通过指定正确的编码机制解决了我的问题。您可能需要做一些实验。我通过 asp classic 和 CDO.Message 成功附加 .pdf、.doc、.xls、.ppt
文件
可用参考这里
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.
Reference available here