Need a macro to replace "from" address with "reply-to" address when receiving an email

I receive emails that are from a web form on a website, where the from field is always 'donotreply@domain.com', but the reply-to field is the senders email address.

The problem is, unless the sender includes their signature in the body, I have to hit reply to see the email address of the sender to know who is sending the email.

Is it possible to have a macro in outlook replace the from field information with the reply-to field info?

Thank you,
Jason
JasonAsked:
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.

David LeeCommented:
Hi, Jason.

In Outlook's object model the sender information (i.e. what you see as From) is read-only.  You cannot replace or change it.  That said, you do have a couple of options.

  1. Use a macro to extract the reply-to information and insert it into the subject line or the body.
  2. Use a macro to extract the reply-to information and insert it into a user-defined field.  You could then add the user-defined field to a view and remove the From column.

The macro for both is essentially the same.  Something like

Sub GetReplyTo(olkMsg As Outlook.MailItem)
    Dim strSender As String
    If olkMsg.ReplyRecipients.Count = 1 Then
        strSender = olkMsg.ReplyRecipientNames
    End If
    olkMsg.Subject = "FROM: " & strSender & " SUBJ:" & olkMsg.Subject
    olkMsg.Save
    Set olkMsg = Nothing
End Sub

Open in new window


This version would insert the sender's name into the subject.  You'd call this macro from a rule you'd create that fires each time a message arrives from 'donotreply@domain.com'.
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
JasonAuthor Commented:
Thanks a lot David. Much appreciated!
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
Exchange

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.