Reply to all emails from unique sender in an Outlook folder


You have a folder full of mails from your
friends. Now you want to reply to each of them sending some fixed
message. One person will get only one reply no matter how many
mails are there from that user. Here’s how you can do
this:

  1. First write an email in Text
    Format.
  2. Save the email. It will go
    to “Drafts” folder. Now drag that email to the folder which
    contains all the emails you want to reply to.
  3. Now press ALT+F11 and paste
    the macro at the end of the post.
  4. Hit F5 and wait for a long
    time. You will see, Outbox has all the reply
    emails.

The macro runs through each and every email
and then checks if the sender is already replied to. If not replied
to, then it gets the body of the message and then makes a reply by
combining your message with the body of the message.

The benefit of this approach is you are
replying to mails sent from someone which has low probability of
getting filtered out by spam filters.

Sub ReplytoALLEmail()
    Dim objFolder As Folder


Dim objTemplate As MailItem
Set objTemplate = Application.ActiveExplorer.Selection.Item(1)

Set objFolder = objTemplate.Parent

Dim objItem As MailItem
Dim objReply As MailItem

Dim dic As New Dictionary

Dim strEmail As String

Dim strEmails As String

Dim strBody As String
strBody = objTemplate.Body

For Each objItem In objFolder.Items
If Not (objTemplate = objItem) Then

strEmail = objItem.SenderEmailAddress

If Not dic.Exists(strEmail) Then
strEmails = strEmails + strEmail + ";"

dic.Add strEmail, ""

Set objReply = objItem.Reply()

objReply.Body = strBody + vbCrLf + vbCrLf + objItem.Body

On Local Error Resume Next
objReply.Send
End If
End If

Next

Debug.Print strEmails
End Sub

13 thoughts on “Reply to all emails from unique sender in an Outlook folder”

  1. hi,

    id like to ask if anybody know how to reply to all the emails in one folder? i have created a folder for each type of emails received in the office and i was just wondering if there is a way to reply to each folder in one message sending, like reply all? instead of replying one by one. 🙁

    thanks.

  2. Omen what elements do I need to define. I keep getting user not defined errors when trying to run this.

    Thanks

    Mark.

  3. While running (F5) it stops on the following lines

    Dim dic As New Dictionary

    Renaming the above as

    Dim dic As DocumentItem

    The following error appears

    runtime error 91
    Object variable or with block variable not set.

    Help please
    Note : I am not from the software )

  4. Hi,

    I’ve tried this with HTML and it worked,
    I couldn’t use the Dictionary object so I’ve dropped it
    I have used FOLDERS object instead of folder

    Thank you for your code!
    Hila.

  5. While running (F5) it stops on the following lines

    Dim dic As New Dictionary

    Renaming the above as

    Dim dic As DocumentItem

    The following error appears

    runtime error 91
    Object variable or with block variable not set.

    Help please
    Note : I am not from the software )

    i have the same problem as another of your quests had… please revert

  6. I’ve tried this script – and it worked for Outlook 2010 but not in that intention I would like..

    Is it possible to mark 2 or more email in inbox and only reply them?

Leave a Reply