Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ASP / Components / August 2008



Tip: Looking for answers? Try searching our database.

CDO Message attachment rename

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Yosi - 31 Jul 2008 15:38 GMT
Hi All

I have recently changed my send email vbscript to work on W2K3 and I am now
using the CDO.Message object. I need to rename files attached to the email
without copying / renaming the file itself. With the old CDONTS.NewMail
object I used in w2k, this was achieved with AttachFile (FilePath,
NewFileName).

There doesn't appear to be a similar function with CDO so I was wandering if
anyone had found a function or a way of doing it.

Many thanx in advance
Yosi
Anthony Jones - 31 Jul 2008 22:53 GMT
> Hi All
>
[quoted text clipped - 6 lines]
> There doesn't appear to be a similar function with CDO so I was wandering if
> anyone had found a function or a way of doing it.

Its a bit messy in CDOSYS you need to rewrite the Content-Disposition header
yourself:-

Const cdoContentDisposition = "urn:schemas:mailheader:content-disposition"

. . .

Function AttachFile(roMsg, rsFilePath, rsNewName)

roMsg.AddAttachment rsFilePath

With roMsg.Attachments(1).Fields
.Item(cdoContentDisposition) = "attachment;filename=" & rsNewName
.Update
End With

End Function

AttachFile(oMsg, "c:\somefolder\somefile.dat", "pinkelephants.dat")

Signature

Anthony Jones - MVP ASP/ASP.NET

Yosi - 02 Aug 2008 23:12 GMT
It works !
Thanks.

>> Hi All
>>
[quoted text clipped - 30 lines]
>
> AttachFile(oMsg, "c:\somefolder\somefile.dat", "pinkelephants.dat")
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.