• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Apple Mail ToName Issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Apple Mail ToName Issue


  • Subject: Re: Apple Mail ToName Issue
  • From: Luther Fuller <email@hidden>
  • Date: Fri, 22 Oct 2010 16:59:04 -0500

On Oct 22, 2010, at 4:27 PM, DealTek wrote:

Trying to grab the name and email of "to..."
If there is no name and just an email I'll get something like:

To: missing value <email@hidden>

Try using '... as text' like this ...

set fromText to (sender of msg) as text

This one line of code is all I use to get the Comment for a saved Mail message. I just reviewed my Mail archives and found not even one problem. If the text before the address is missing, it's just does not appear. And my script does not even look at the content of fromText. All I do is ...

set comText to "From: " & fromText

where comText is written to the Comment of a saved .emlx file.

For recipients, I use this ...

tell application "Mail"
set toList to (to recipients of msg)
set toShortList to {}
repeat with i from 1 to (count items of toList)
if i > 3 then exit repeat
item i of toList
try
((name of the result) as text) & " <" & ((address of the result) as text) & ">"
on error
"<" & ((address of the result) as text) & ">"
end try
set toShortList to toShortList & {the result}
end repeat
end tell

If the 'name' is missing, then the comment simply appears as "To: <...@...>".

 _______________________________________________
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

  • Follow-Ups:
    • Re: Apple Mail ToName Issue
      • From: Luther Fuller <email@hidden>
References: 
 >Apple Mail ToName Issue (From: DealTek <email@hidden>)

  • Prev by Date: Re: Can't drop onto my app
  • Next by Date: Re: Apple Mail ToName Issue
  • Previous by thread: Re: Apple Mail ToName Issue
  • Next by thread: Re: Apple Mail ToName Issue
  • Index(es):
    • Date
    • Thread