McKilty
2011-05-16 15:39:47 UTC
I have a routine which loops through a group of emails. If the emails
meet a specific criteria, I want to add them to a new email. I do not
know how to add an email as an attachment.
The following is parts of my code:
'----------------------------------------------------------------------
Set mItemCollection = mItemCollection.Restrict("[SentOn] > '" &
Format(dteStart, "yyyy-mm-dd hh:nn:ss") & "' AND [SentOn] < '" &
Format(dteEnd, "yyyy-mm-dd hh:nn:ss") & "'")
For lMailItem = 1 To mItemCollection.Count
Set myItem = mItemCollection(lMailItem)
Set SafeMail = CreateObject("Redemption.SafeMailItem")
SafeMail.Item = myItem
'If Criteria is true then add attachment
'If email is not already created then
Set objOutlookMsg = Outlook.CreateItem(olMailItem)
'Set recipients, subject, body
'else if email is already created
objOutlookMsg.Attachments.Add SafeMail.item
'----------------------------------------------------------------------
This does not work, but I really didn't expect it to. How do I attach
the emails to this new email?
meet a specific criteria, I want to add them to a new email. I do not
know how to add an email as an attachment.
The following is parts of my code:
'----------------------------------------------------------------------
Set mItemCollection = mItemCollection.Restrict("[SentOn] > '" &
Format(dteStart, "yyyy-mm-dd hh:nn:ss") & "' AND [SentOn] < '" &
Format(dteEnd, "yyyy-mm-dd hh:nn:ss") & "'")
For lMailItem = 1 To mItemCollection.Count
Set myItem = mItemCollection(lMailItem)
Set SafeMail = CreateObject("Redemption.SafeMailItem")
SafeMail.Item = myItem
'If Criteria is true then add attachment
'If email is not already created then
Set objOutlookMsg = Outlook.CreateItem(olMailItem)
'Set recipients, subject, body
'else if email is already created
objOutlookMsg.Attachments.Add SafeMail.item
'----------------------------------------------------------------------
This does not work, but I really didn't expect it to. How do I attach
the emails to this new email?