I would like to get the email address from the true contact that is sending the mailItem. I don't want the on behalf email address.
Is there a way to do that?
Outlook mailItem example
This is my code:
Function GetSenderSMTPAddress(ByRef olkMailItem As Outlook.MailItem) As String Dim olkSender As AddressEntry Set olkSender = olkMailItem.sender GetSenderSMTPAddress = GetSMTPAddress(olkSender) End Function Function GetSMTPAddress(ByRef olkAddress As AddressEntry) As String Dim smtpAddress As String: smtpAddress = olkAddress.Address Dim olkExUser As ExchangeUser If olkAddress.AddressEntryUserType = olExchangeUserAddressEntry Or _ olkAddress.AddressEntryUserType = olExchangeRemoteUserAddressEntry Then Set olkExUser = olkAddress.GetExchangeUser End If If Not IsNull(olkExUser) Then smtpAddress = olkExUser.PrimarySmtpAddress End If GetSMTPAddress = smtpAddress End Function