user3138025
user3138025

Reputation: 825

How do I duplicate / copy an Outlook MailItem

I have a user who sends eMails to a large "To" list, Sometimes over 20 addresses. With this large a "To" list, the received mail sometimes ends up on the recipient's SPAM folder. Obviously, we'd like to avoid this.

My idea is to have the user create an original eMail and then run a Macro. The Macro would loop through all the eMail addresses in an Excel worksheet and then copy the original message and send it to each recipient individually.

I'm unsure as to how to copy a MailItem from the original to a new MailItem. The Excel looping works fine.

Here's my abbreviated macro:

Option Explicit
Sub Send_emails()
'.
'.
Set objDoc = objInspector.WordEditor
Set objWrdApp = objDoc.Application
Set objSelection = objWrdApp.Selection
'Loop through the Rows in the worksheet.  Start at row 2 to ignore header
For lngCurrSheetRow = 2 To lngLastSheetRow
    strEmailAddress = objWorksheet.Cells(lngCurrSheetRow, 1).Value
    'Set objNewMail so that the new message is created and can be referenced.
    Set objNewMail = Application.CreateItem(0)
    With objNewMail
        .Body = objSelection
        .To = strEmailAddress
    End With
Next lngCurrSheetRow
'.
'.
End Sub

Upvotes: 1

Views: 588

Answers (1)

0m3r
0m3r

Reputation: 12499

To copy mailitem.body Example would be

Option Explicit
Sub Send_emails()

        Dim olMsg As Outlook.MailItem
        Set olMsg = ActiveExplorer.Selection.Item(1)

        Dim objNewMail As Outlook.MailItem
        Set objNewMail = Application.CreateItem(0)

        With objNewMail
            .Body = olMsg.Body
            .Display
        End With
End Sub

For HTML Body simply do HTMLBody = olMsg.HTMLBody

Upvotes: 1

Related Questions