Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-07-2015, 05:44 AM
oumahexi oumahexi is offline Outlook 2010 Rule nightmare Replies Windows XP Outlook 2010 Rule nightmare Replies Office 2007
Novice
Outlook 2010 Rule nightmare Replies
 
Join Date: Jan 2012
Posts: 6
oumahexi is on a distinguished road
Angry Outlook 2010 Rule nightmare Replies

Hi
I receive emails on a daily basis from a supplier. They are copied to me with the original recipient being in the To box. The recipient varies, we have some 8,000 employees and it could be sent originally to any one of them. I need to automatically message the person in the "to" box when these emails come in.

As there are various messages that need to be responded to I have created templates to deal with the actual message. My problem is that when I run the reply message it only replies to the supplier. I don't want the message to go to the supplier, I want it to go to the original recipient, who could be anybody.

Any suggestions on how I can get rules to only send to the person whose name is appears in the "To" box and not the "From" box.

Thank you in advance.
Reply With Quote
  #2  
Old 10-07-2015, 06:53 AM
gmayor's Avatar
gmayor gmayor is offline Outlook 2010 Rule nightmare Replies Windows 7 64bit Outlook 2010 Rule nightmare Replies Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

You are going to need a macro script, to create the message, but in order for us to help with that, we are going to need some more information.

As I understand it, you are going to receive messages which have been CC'd to you. i.e. your e-mail address is in the 'CC' field of the message, with the 'TO' field bearing the address of assorted recipients?

Having received those messages, you want to send a message based on a template to the address in the 'TO' field.

How do you determine which template to use?

What happens to the original message? Do you want to attach it to the message, or do you want to include it in the message body?

Does the template contain all the information you require, or do you need to add text to it?
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 10-07-2015, 07:02 AM
oumahexi oumahexi is offline Outlook 2010 Rule nightmare Replies Windows XP Outlook 2010 Rule nightmare Replies Office 2007
Novice
Outlook 2010 Rule nightmare Replies
 
Join Date: Jan 2012
Posts: 6
oumahexi is on a distinguished road
Default

Hi Gmayor, thank you for your quick reply.

An example of the messages received would be as follows:

From: Mysupplier@outside.com
To: Joe.blogg@inside.co.uk
CC: Ouma.Hexi@inside.co.uk

The subject line varies but in the body of the message is always the reason for the supplier getting in touch, one of the more common phrases that would trigger a response would be "limited author" and another might be "cannot read your email" (it is all coming from our encrypted email supplier).

Once the message is determined it then looks for the specified template - Template1 or Template2, moves the message to another folder, Message1 or Message2 and then should reply to the person listed in the TO box with a message explaining why their mail has failed (our supplier does not go into enough depth for our users).

The templates used read "you received this message from our supplier because..." so it does need to retain the body of the text received from the supplier so that the user knows what we are referring to.

Many thanks in advance.

Ouma

Quote:
Originally Posted by gmayor View Post
You are going to need a macro script, to create the message, but in order for us to help with that, we are going to need some more information.

As I understand it, you are going to receive messages which have been CC'd to you. i.e. your e-mail address is in the 'CC' field of the message, with the 'TO' field bearing the address of assorted recipients?

Having received those messages, you want to send a message based on a template to the address in the 'TO' field.

How do you determine which template to use?

What happens to the original message? Do you want to attach it to the message, or do you want to include it in the message body?

Does the template contain all the information you require, or do you need to add text to it?
Reply With Quote
  #4  
Old 10-07-2015, 10:08 PM
gmayor's Avatar
gmayor gmayor is offline Outlook 2010 Rule nightmare Replies Windows 7 64bit Outlook 2010 Rule nightmare Replies Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

The following script should do the trick when run from your rule. Select a message and use the Test macro to test the setup, then make the changes indicated.

Code:
Option Explicit
Sub TestReply()
Dim olMsg As MailItem
    On Error Resume Next
    Set olMsg = ActiveExplorer.Selection.Item(1)
    AutoReply olMsg
lbl_Exit:
    Exit Sub
End Sub


Sub AutoReply(oItem As MailItem)
Dim olInsp As Outlook.Inspector
Dim wdDoc As Object
Dim oRng As Object
Dim olOutMail As MailItem
Dim strTemplate As String
Const strTemplatePath As String = "D:\Word 2010 Templates\" 'The path to the templates
    With oItem
        MsgBox .CC 'remove after testing
        If .CC = "Ouma.Hexi@inside.co.uk" Then 'Use the text that appears in the message box above
            Set olInsp = .GetInspector
            Set wdDoc = olInsp.WordEditor
            Set oRng = wdDoc.Range
            With oRng.Find
                Do While .Execute(FindText:="limited author")
                    strTemplate = strTemplatePath & "Template1.oft"
                    Exit Do
                Loop
                GoTo CreateMessage
            End With
            Set oRng = wdDoc.Range
            With oRng.Find
                Do While .Execute(FindText:="cannot read your email")
                    strTemplate = strTemplatePath & "Template2.oft"
                    Exit Do
                Loop
                GoTo CreateMessage
            End With
CreateMessage:
            .Display
            wdDoc.Range.Copy
            .Close 0
            Set olOutMail = CreateItemFromTemplate(strTemplate)
            With olOutMail
                .To = oItem.To
                .Subject = oItem.Subject
                Set olInsp = .GetInspector
                Set wdDoc = olInsp.WordEditor
                Set oRng = wdDoc.Range
                oRng.collapse 0
                oRng.Paste
                .Display
                '.Send 'Restore after testing
            End With
        End If
    End With
lbl_Exit:
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #5  
Old 10-08-2015, 12:16 AM
oumahexi oumahexi is offline Outlook 2010 Rule nightmare Replies Windows XP Outlook 2010 Rule nightmare Replies Office 2007
Novice
Outlook 2010 Rule nightmare Replies
 
Join Date: Jan 2012
Posts: 6
oumahexi is on a distinguished road
Default

Thank you so much. I will give this a try and let you know how it goes. Much appreciated.
Reply With Quote
  #6  
Old 10-08-2015, 03:03 AM
oumahexi oumahexi is offline Outlook 2010 Rule nightmare Replies Windows XP Outlook 2010 Rule nightmare Replies Office 2007
Novice
Outlook 2010 Rule nightmare Replies
 
Join Date: Jan 2012
Posts: 6
oumahexi is on a distinguished road
Default

OK, I've tried the code you suggested and it appears to run but it doesn't. Any suggestions?
A screen flashes up saying that it's running then you can see a progress bar indicating that it is scanning something, but it doesn't do anything after that.
Reply With Quote
  #7  
Old 10-08-2015, 04:00 AM
gmayor's Avatar
gmayor gmayor is offline Outlook 2010 Rule nightmare Replies Windows 7 64bit Outlook 2010 Rule nightmare Replies Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Did you change the template path and template names to those that you have there?
When you run the test macro did you see the message box and did you transfer the value in that message box that relates to you to the following line?
Does the message tested have either of the text strings in the message body?
It will only work if the criteria correctly reflect what you have there.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #8  
Old 10-08-2015, 06:37 AM
oumahexi oumahexi is offline Outlook 2010 Rule nightmare Replies Windows XP Outlook 2010 Rule nightmare Replies Office 2007
Novice
Outlook 2010 Rule nightmare Replies
 
Join Date: Jan 2012
Posts: 6
oumahexi is on a distinguished road
Default

Yes, I changed all of the information to relate to our situation.

When I run the macro I see the message box but it is empty.

Yes the message tested has one of the text strings in the message body.
Reply With Quote
  #9  
Old 10-08-2015, 09:08 PM
gmayor's Avatar
gmayor gmayor is offline Outlook 2010 Rule nightmare Replies Windows 7 64bit Outlook 2010 Rule nightmare Replies Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

If the message box shows nothing, then the message presumably has no value in the CC field, around which the process resolves. You said the messages were copied to you?
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #10  
Old 10-09-2015, 12:18 AM
oumahexi oumahexi is offline Outlook 2010 Rule nightmare Replies Windows XP Outlook 2010 Rule nightmare Replies Office 2007
Novice
Outlook 2010 Rule nightmare Replies
 
Join Date: Jan 2012
Posts: 6
oumahexi is on a distinguished road
Default

They are copied to me.
I work for local government so can't give full information on a shared site, would you mind if I pm you the changes I made then we can share the reason for my error without divulging any state secrets lol.
Reply With Quote
  #11  
Old 10-09-2015, 12:48 AM
gmayor's Avatar
gmayor gmayor is offline Outlook 2010 Rule nightmare Replies Windows 7 64bit Outlook 2010 Rule nightmare Replies Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

e-mail me at supportATgmayor.com and put your forum username in the subject
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook 2010 Rule nightmare Replies Outlook eating my replies Cec Britton Outlook 1 08-16-2014 09:41 AM
Outlook 2010 Rule nightmare Replies Replies In Outlook Go To My Inbox abraxis Outlook 2 06-07-2014 11:51 AM
Outlook 2010 Rule nightmare Replies Outlook 2010 rule not working khughes46 Outlook 1 05-06-2014 10:09 AM
Outlook 2010 Rule nightmare Replies Outlook 2007/2010 - need a rule to approve /reject emails before actual sending senglory Outlook 1 09-12-2011 10:09 AM
Outlook 2010 rule has stopped 'seeing' Contact entries LakeGator Outlook 0 11-11-2010 07:31 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:27 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft