Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / June 2004

Tip: Looking for answers? Try searching our database.

Duplicating the body of mail item

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Amin Sobati - 10 Jun 2004 09:51 GMT
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
Sue Mosher [MVP-Outlook] - 10 Jun 2004 13:16 GMT
Instead of copying the Body, copy the entire message:

   Set MyMailItem = UserMailItem.Copy

Then change the recipients for MyMailItem as needed and send.

Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> Hi,
> I have written an application that opens a new mail item for the user and
[quoted text clipped - 12 lines]
> Thanks!
> Amin
Amin Sobati - 10 Jun 2004 14:39 GMT
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.

> Instead of copying the Body, copy the entire message:
>
[quoted text clipped - 26 lines]
> > Thanks!
> > Amin
Sue Mosher [MVP-Outlook] - 10 Jun 2004 15:11 GMT
So what? Just set MyMailItem.To.

Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> Sue,
> When I use 'Copy' method, there might be a lot of recipients in UserMailItem
[quoted text clipped - 6 lines]
> >
> > Then change the recipients for MyMailItem as needed and send.

> > > Hi,
> > > I have written an application that opens a new mail item for the user
[quoted text clipped - 14 lines]
> > > Thanks!
> > > Amin
Amin Sobati - 10 Jun 2004 15:17 GMT
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

> So what? Just set MyMailItem.To.
>
[quoted text clipped - 36 lines]
> > > > Thanks!
> > > > Amin
Sue Mosher [MVP-Outlook] - 10 Jun 2004 16:52 GMT
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))

Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> Thanks Sue,
> Another problem is that when I use 'Copy', a blank(empty) email is generated
[quoted text clipped - 64 lines]
> > > > > Thanks!
> > > > > Amin
 
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



©2009 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.