开发者

.addattachment not working with none standard file extensions

开发者 https://www.devze.com 2023-02-07 11:40 出处:网络
I have some code which sends emails out with an attachment. sch = \"http://schemas.microsoft.com/cdo/configuration/\"

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号