C
Chad
I am looking for some help with setting up the following rule:
when mail is received in inbox from "(e-mail address removed)" with the subject
"Email Subject," do the following:
-sends reply to the "reply-to" address not the "from" address
-includes original message text in body of reply
I have no problem setting up the rule to pull the from and subject lines,
also I have set it to run a script, however I think I am having difficulties
pulling the reply address.
This is what I have come up with so far. Also, I am putting this code in
ThisOutlookSession
Sub AutoReply(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim msg As Outlook.MailItem
Dim rply As Outlook.MailItem
strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set msg = olNS.GetItemFromID(strID)
Set rply = msg.Reply
rply.Body = msg.Body
rply.Subject = msg.Subject
rply.To = msg.ReplyRecipients.Item(1).Address
rply.Send
Set msg = Nothing
Set rply = Nothing
Set olNS = Nothing
End Sub
If you couldn't tell, this is my first time doing any script programming for
Outlook, so I am sure I am just missing something obvious.
Thanks!
when mail is received in inbox from "(e-mail address removed)" with the subject
"Email Subject," do the following:
-sends reply to the "reply-to" address not the "from" address
-includes original message text in body of reply
I have no problem setting up the rule to pull the from and subject lines,
also I have set it to run a script, however I think I am having difficulties
pulling the reply address.
This is what I have come up with so far. Also, I am putting this code in
ThisOutlookSession
Sub AutoReply(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim msg As Outlook.MailItem
Dim rply As Outlook.MailItem
strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set msg = olNS.GetItemFromID(strID)
Set rply = msg.Reply
rply.Body = msg.Body
rply.Subject = msg.Subject
rply.To = msg.ReplyRecipients.Item(1).Address
rply.Send
Set msg = Nothing
Set rply = Nothing
Set olNS = Nothing
End Sub
If you couldn't tell, this is my first time doing any script programming for
Outlook, so I am sure I am just missing something obvious.
Thanks!