Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > CDO Message attachment rename

Reply
Thread Tools

CDO Message attachment rename

 
 
Yosi
Guest
Posts: n/a
 
      07-31-2008
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


 
Reply With Quote
 
 
 
 
Anthony Jones
Guest
Posts: n/a
 
      07-31-2008
"Yosi" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>



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")



--
Anthony Jones - MVP ASP/ASP.NET


 
Reply With Quote
 
 
 
 
Yosi
Guest
Posts: n/a
 
      08-02-2008
It works !
Thanks.


"Anthony Jones" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "Yosi" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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.
>>

>
>
> 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")
>
>
>
> --
> Anthony Jones - MVP ASP/ASP.NET
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Attachment Using CDO.MESSAGE RN1 ASP General 9 12-23-2007 09:22 PM
CDO.MESSAGE ATTACHMENT rn5a@rediffmail.com ASP General 4 05-21-2007 07:06 PM
what is ("http://schemas.microsoft.com/cdo/configuration/sendusing") doing in CDO uofs76@yahoo.com ASP General 0 02-07-2007 01:09 PM
Need help sending CDO email with dynamic HTML attachment NetNoise ASP General 6 01-10-2005 03:49 AM
CDO for Windows 2000 vs CDO for Exchange 2000 ASP .Net 2 07-11-2003 12:31 PM



Advertisments