Duplicating the body of mail item

  • Thread starter Thread starter Amin Sobati
  • Start date Start date
A

Amin Sobati

Hi,
I have written an application that opens a new mail item for the user and
when the user selects the required contacts to send them this email and
presses the send button, my app generates a new mail item per each recipient
that user has selected.
I use something like this code to copy the body of main email to my
generated emails:

MyMailItem.Body = UserMailItem.Body

But when the main email contains picture or hyperlinks, they are not
transferred to my generated emails, only the plain texts go there.
What's the solution?
Any help would be greatly appreciated.
Thanks!
Amin
 
Instead of copying the Body, copy the entire message:

Set MyMailItem = UserMailItem.Copy

Then change the recipients for MyMailItem as needed and send.
 
Sue,
When I use 'Copy' method, there might be a lot of recipients in UserMailItem
that come to MyMailItem too, but I need to copy just the body of
UserMailItem.
 
So what? Just set MyMailItem.To.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Thanks Sue,
Another problem is that when I use 'Copy', a blank(empty) email is generated
per each MailItem that I create. This is my code written in ItemSend event:

Private Sub OA_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim R As Recipient
Dim tmpMail As MailItem
For Each R In Item.Recipients
Set tmpMail = OA.CreateItem(olMailItem)
Set tmpMail = tmpMail.Move(NS.GetDefaultFolder(olFolderOutbox))
Set tmpMail = Item.Copy
'Emptying the recipients:
For i = 1 To tmpMail.Recipients.Count
tmpMail.Recipients.Remove 1
Next
'Add the email address:
tmpMail.Recipients.Add R
Set objSafeMail = CreateObject("Redemption.SafeMailItem")
tmpMail.Save
Set objSafeMail.Item = tmpMail
objSafeMail.Send
Next
End Sub

Thank you again,
Amin
 
These statements create a blank email message and try to move it to the
Outbox. You don't need them:
Set tmpMail = OA.CreateItem(olMailItem)
Set tmpMail = tmpMail.Move(NS.GetDefaultFolder(olFolderOutbox))

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top