TheOne23 Posted February 5, 2019 Posted February 5, 2019 Hi MVPs, Experts, I would like to ask your kind assistance on how to retrieve email address of senders in outlook. Water helped me last time to retrieve email address for exchange users and now I need to retrieve even the external users. ex. if user sends email to my yahoo account and they use google account I cannot retrieve this google email address. But it it is associated to yahoo it can be retrieved. below is my existing code (courtesy of Water) Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended) Global $aOL_Item = _OL_ItemFind($oOutlook, "RonaldJayson_paggao@comcast.com\Inbox\BP_automation", $olMail, "[UnRead]=True", "", "", "EntryID,body,receivedtime,senderemailaddress", "", 2) _ArrayDisplay($aOL_Item) Local $oOL_Item = $oOutlook.Session.GetItemFromID($aOL_Item[1][0], Default) Local $oOL_Sender = $oOL_Item.Sender If $oOL_Sender.AddressEntryUserType = $olExchangeUserAddressEntry Or $oOL_Sender.AddressEntryUserType = $olExchangeRemoteUserAddressEntry Then Local $oExchangeUser = $oOL_Sender.GetExchangeUser MsgBox(0, "Mail", $oExchangeUser.PrimarySmtpAddress) Else MsgBox(0,"Mail","Failed") EndIf Regards, Ronald
water Posted February 5, 2019 Posted February 5, 2019 In this case the mail address gets returned in the array by _OL_ItemFind as senderemailaddress. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
TheOne23 Posted February 5, 2019 Author Posted February 5, 2019 Hi Water, Is there a way to capture the email address of the sender if the sender has external email? Thanks
water Posted February 5, 2019 Posted February 5, 2019 (edited) I tested with an external address (e.g. john.doe@gmx.com) and this is returned in $aOL_Item[1][2] or $oOL_Item.SenderEmailAddress (based on your script). Edited February 5, 2019 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
TheOne23 Posted February 5, 2019 Author Posted February 5, 2019 Hi Water, Thank you for your great help. I already got it and extract the email from the array. Thank you very much.
water Posted February 5, 2019 Posted February 5, 2019 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now