Re: Searching a Mail message
Re: Searching a Mail message
- Subject: Re: Searching a Mail message
- From: Philip Aker <email@hidden>
- Date: Fri, 1 Jun 2007 07:16:25 -0700
On 2007-06-01, at 06:17:13, Jeffers wrote: I'm after getting the content of a Mail message and want to search the content for an email address (email@hidden). Are there any helper methods in AppleScript in which to do this. I already tried parsing the message content but that didnt seem to work.
Here's a starter script. It'll only grab the first address from a paragraph. It works on my setup but not everyone's got Mail setup the same:
on PluckEmailAddresses() tell application "Mail" to tell item 1 of (get selection) set paras to every paragraph of (source as text) set res to {} repeat with i from 1 to count of paras set p to item i of paras if (p contains "mailto:" and p contains "<a href=""Apple-style-span" color="#0D407F">then set s to offset of "mailto:" in p set t to (characters s thru -1 of p) as text set e to (offset of ">" in t) - 3 set end of res to (characters s thru (s + e) of p) as text end if end repeat res end tell end PluckEmailAddresses PluckEmailAddresses()
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden