[Webinar] Streamline your web hosting managementRegister Today


Extract Email address from Sender?

Posted on 2010-04-02
Medium Priority
Last Modified: 2012-05-09
I am trying to extract the domain from the email address of a sender of an email received in MS Entourage.

The code gets the full detail (i.e. {address:"nadda@middlebutler.info", display name:"AirlineTickets"} ) but I can not see a method of extracting the domain of the sender?

tell application "Microsoft Entourage"
	set theSelection to selection
	set theCurrentMessage to item 1 of theSelection
	sender of theCurrentMessage
end tell

Open in new window

Question by:PeterRHawkes

Expert Comment

ID: 29499772
Open up the email header and look for the very last IP address entry in it. The IP SHOULD be in [ ], so try the very last IP thats in [ ]. Once you get that IP, go to http://whois.domaintools.com/ . Once there, type in the IP address that you got and it should tell you what domain the email was sent from.
LVL 18

Accepted Solution

Simon earned 2000 total points
ID: 29657734
Hi, From your question, I understand you wish to extract the domain from the sender's address, which the code below will demonstrate. As posted, it returns the senders username and domain as a 2-element array. Change the last line to 'return senderDomain' if you only want the domain.

1209yl's post above describes a more forensic approach to determining the true originating domain. I'm not sure which you're interested in.

p.s. there is no built-in Applescript method in Entourage to get just the sender's domain, so it requires string manipulation as demonstrated in the code snippet.

tell application "Microsoft Entourage"
	set theSelection to selection
	set theCurrentMessage to item 1 of theSelection
	sender of theCurrentMessage
	log sender
	--headers of theCurrentMessage -- Get headers if you want to examine the IPs in the SMTP route.
	set theSenderAddress to address of sender of theCurrentMessage
	--Find the position of the "@" in the sender adddress
	set domainDelimiter to the offset of "@" in theSenderAddress
	set senderName to text 1 thru (domainDelimiter - 1) of theSenderAddress
	set senderDomain to text (domainDelimiter + 1) thru -1 of theSenderAddress
	return {senderName, senderDomain}
end tell

Open in new window


Featured Post

2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
If you have a smartphone, I'm sure you've noticed that web applications are changing. Yet, are you aware of how these changes are going to impact your organization or company?
Planning to migrate your EDB file(s) to a new or an existing Outlook PST file? This video will guide you how to convert EDB file(s) to PST. Besides this, it also describes, how one can easily search any item(s) from multiple folders or mailboxes…
There may be issues when you are trying to access Outlook or send & receive emails or due to Outlook crash which leads to corrupt or damaged PST file. To eliminate the corruption from your PST file, you need to repair the corrupt Outlook PST file. U…
Suggested Courses

608 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question