For Programmers: Free Programming Magazines  


Home > Archive > VBScript > September 2004 > CDO IBodyParts









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author CDO IBodyParts
Sean

2004-09-29, 10:43 am

Dear All,

I'm currently bilding up my test environment but I am wondering if
someone can save me a little time on this.
According to MSDN documentation the IBodyParts interface is read only
for the Count, Item and NewEnum properties. I am looking at using the Count
property to enemerate the pieces of an outbound SMTP message and then strip
any and all attachments that are anything other than the type text/html or
text/plain using the Delete method. Am I looking at this correctly or can I
only use the Delete method with items that I have created on the object or
can I remove other items from the IMessage object that I am working with?

example:

const cDisclaimer = "In order to reduce the size of your blackberry message
we have removed"

Sub ISMTPOnArrival_OnArrival(ByVal Msg, EventStatus )

'This will strip any attachments from the message.


Dim MessagePieces


Set MessagePieces = Msg.BodyPart


MessagePieces.DeleteAll


Msg.TextBody = Msg.TextBody & cDisclaimer & MessagePieces.Count &
"attachments"


'This will insert an HTML formated disclaimer to the end of the HTML portion
of the message

Msg.HTMLBody = Replace(Msg.HTMLBody,"</body>",("<P>"& cDisclaimer &
MessagePieces.Count & " attachments</P></body>"),1,-1,1)


Msg.DataSource.Save

EventStatus = cdoRunNextSink

End Sub


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com