Outlook Macro to autoreply all mails in a folder.

Hi,

Outlook Macro to autoreply all mails in a folder.
I have a folder in outlook that has say about 2000+ mails that i received details from the employees.I need a macro that can reply each mail with a data. " Thanks the data has been update"
This data has to be sent to each mail i received.Is there a easy way in doing this.

Regards
Sharath
LVL 11
bsharathAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SolutionsCSCommented:
You can use an autoreply to answer message at there reception.  Or you can write a macro to read an existing folder and reply to every message in the folder of your needs.
0
bsharathAuthor Commented:
Autoreply would not be fine as i already have these in the folder.Can you help with a macro to do this...
0
SolutionsCSCommented:
Here is a bit of code to do this


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

Open in new window

0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

bsharathAuthor Commented:
Thanks Should i select the folder or mails to execute these.
Where should i mention the reply details.
0
SolutionsCSCommented:
Actually the content of the reply is issue from a selected message when this macro is called.
  Set objTemplate = Application.ActiveExplorer.Selection.Item(1)

You have to replace this with your reply or whatever else to achieve your goal.
objReply.Body = " Your content"
0
bsharathAuthor Commented:
Will the mails go to all the users in the folder that i select.
Please give me the clear picture how this works.I dont want to be sending replys to lakhs of persons whose mails i have in the inbox and other folders...
0
SolutionsCSCommented:
Tomorrow, i'll do it for you.  Now i have to sleep.  Thanks for waiting
0
bsharathAuthor Commented:
Any help...
0
bsharathAuthor Commented:
Any help...
0
David LeeCommented:
Sharath,

The code below will do the job.  Select one or more messages in a folder and run the macro.  It'll reply to every message selected.  If you want to reply to all messages in a folder, then use CTRL+A to select them all.

Keep in mind that sending messages from code is going to trigger Outlook's built-in security.  Outlook will display a dialog-box warning that a program is trying to send a message and ask for your permission to allow it to continue.  That's going to happen for each message.  Outlook security can't be turned off, but there are third-party workarounds: Outlook Redemption (http://www.dimastr.com) and Click-Yes (http://www.contextmagic.com/express-clickyes).  
Sub ReplyToAllSelected()
    Const REPLY_TEXT = "Thanks the data has been updated."
    Dim olkMsg As Object, _
        olkReply As Object
    For Each olkMsg In Application.ActiveExplorer.Selection
        Set olkReply = olkMsg.Reply
        If olkReply.BodyFormat = olFormatHTML Then
            olkReply.HTMLBody = REPLY_TEXT & "<br><br>" & olkReply.HTMLBody
        Else
            olkReply.Body = REPLY_TEXT & vbCrLf & vbCrLf & olkReply.Body
        End If
        olkReply.Send
    Next
    Set olkMsg = Nothing
    Set olkReply = Nothing
    MsgBox "All done!", vbInformation + vbOKOnly, "Reply to All Selected"
End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bsharathAuthor Commented:
Thanks a lot... Excellent help... ;-)
0
David LeeCommented:
You're welcome, Sharath.
0
bsharathAuthor Commented:
BlueDevilFan

If time permits please look at the other posts on outlook .....
0
bsharathAuthor Commented:
Hi David,
 Can you please help with this post.
http://www.experts-exchange.com/Software/Office_Productivity/Groupware/Outlook/Q_23614898.html
its the same post here with a little more additions required...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.