This macro demonstrates how to pick up the sender's address and use it for a new message. This was originally put together for a user who wanted to send email using the address of one of several shared mailbox automatically. Beyond using it for redirecting mail, it's more of a concept macro, showing how to grab the sender's address from an email email. Otherwise, it's probably not very useful to most people.
Public Sub SendFromAddressOfCurrentEmail() Dim Session As Outlook.NameSpace Dim currentExplorer As Explorer Dim Selection As Selection Dim currentItem As Object Dim currentMail As MailItem Dim smtpAddress As String Set currentExplorer = Application.ActiveExplorer Set Selection = currentExplorer.Selection For Each currentItem In Selection If currentItem.Class = olMail Then Set currentMail = currentItem smtpAddress = currentMail.SenderEmailAddress End If Next Dim oMail As Outlook.MailItem ' Send new message ' Set oMail = Application.CreateItem(olMailItem) 'Send reply Set oMail = Application.ActiveExplorer.Selection(1).Reply oMail.SentOnBehalfOfName = smtpAddress oMail.Display End Sub
To send a message using the To address, change smtpAddress = currentMail.SenderEmailAddress to smtpAddress = currentMail.To
If currentItem.Class = olMail Then Set currentMail = currentItem smtpAddress = currentMail.To End If