PDA

View Full Version : Sender and Recipient Address From Email



shudder
02-15-2017, 02:01 PM
Hi Guys,

I have found the following code which I have adapted to collate the senders email address from the currently selected email. However, I would like to expand on this to also collate the recipients email address.

Can any body offer any input or alternative code which will suit my needs.



Public Sub GetSmtpAddressOfCurrentEmail()
Dim currentExplorer As Explorer
Dim currentItem As Object
Dim sSender As Variant

Set currentExplorer = Application.ActiveExplorer

If Application.ActiveExplorer.Selection.Count = 1 Then
Set currentItem = ActiveExplorer.Selection.Item(1)
sSender = GetSmtpAddress(currentItem)
MsgBox sSender
Else
MsgBox ("Please select only one message.")
Exit Sub
End If

End Sub



I cannot post the function due to URL restrictions, but it can be found here - gregthatcher.com Scripts VBA Outlook GetSmtpAddress.aspx (Replace the spaces with /)

Thanks in advance.

gmayor
02-15-2017, 10:45 PM
Greg Thatcher's web site also includes code that details all the information that can be gleaned from an e-mail message - http://gregthatcher.com/Scripts/VBA/Outlook/GetEmailInfoUsingPropertyAccessor.aspx

realitydrm
03-13-2017, 08:33 PM
Looking to automatically save an incoming email that was saved to an outlook folder to a folder on my hard drive using particular keywords from the email subject line. Thank you.

shudder
03-17-2017, 04:31 AM
Greg Thatcher's web site also includes code that details all the information that can be gleaned from an e-mail message

Thanks, I have tried all of the Outlook scripts on the website and I cannot seem to modify to my requirements.

I want to restrict this to purely the sender and recipient email addresses themselves i.e.

sender at sender dot com
recipient at recipient dot com