While trying to fix a problem in a script, yesterday, I encountered a problem (bug?) in Mail.
I noticed that messages copied into the Finder showed a comment like this …
missing value <name@address>
These comments are recent, so I presume that they started appearing after I upgraded to Lion.
I fixed my script to avoid the "missing value" (I just leave that blank), but I can't avoid Mail returning missing value for the name of a recipient. Something seems to be wrong with Mail.
Here is the script I used for testing in Smile …
tell application "Mail"
set selMsgList to selection
set msg to (item 1 of selMsgList)
set recipientList to (to recipients of msg)
set recipientList to recipientList & (cc recipients of msg)
set recipientList to recipientList & (bcc recipients of msg)
--
set recipientText to ""
repeat with i from 1 to (count items of recipientList)
(item i of recipientList)
((name of the result) as Unicode text) & " <" & ((address of the result) as Unicode text) & ">" & return
set recipientText to recipientText & the result
end repeat
end tell
log recipientText & return
but the message, when viewed in Mail shows "
Fuller X Luther <email@hidden>".
The "X" was added to my Address Book a few minutes ago as a test. (and will soon be removed)
Mail seems to be looking-up names in the Address Book and, perhaps, returning 'missing value' when the look-up fails.
but the message displays "
Applescript Users <email@hidden>".
Other messages do log recipients correctly, for example:
None of these matches my Address Book (which shows "AppleScript Users").
Has anyone seen this? Have any ideas?