79356112

Date: 2025-01-14 19:09:08
Score: 3.5
Natty:
Report link

We still don't have a correct answer. I have email forms coming for my website from "[email protected] on behalf of [email protected]", as en example.

When you manually click within Outlook to reply, it correctly identifies the correct recipient, ie the Gmail address and NOT [email protected].

Now, how to reproduce this with a a VB Macro in Outlook as I have a few job application reply templates I want to choose from (ie job rejection, or more info etc), and I everything else works and displays correctly, just NOT the correct recipient email address.

I have this:

Sub RejectionEmail()

Dim origEmail As MailItem
Dim replyEmail As MailItem


Set origEmail = Application.ActiveWindow.Selection.Item(1)
Set replyEmail = Application.CreateItemFromTemplate("C:\Users\Daniel\AppData\Roaming\Microsoft\Templates\Rejection.oft")

replyEmail.To = origEmail.Sender    
replyEmail.CC = origEmail.CC


replyEmail.HTMLBody = replyEmail.HTMLBody & origEmail.Reply.HTMLBody
replyEmail.Display

End Sub

I have tried "replyEmail.To = origEmail.SenderEmailAddress" also, no go.

What is the ORIGINAL script Outlook uses to make this work I wonder?

Reasons:
  • RegEx Blacklisted phrase (1): I want
  • Long answer (-1):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Looks like a comment (1):
  • Low reputation (1):
Posted by: OffshoreAdvice