• 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: Scripting Mail
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scripting Mail


  • Subject: Re: Scripting Mail
  • From: Luther Fuller <email@hidden>
  • Date: Tue, 11 Apr 2006 13:36:27 -0500

Pat Stanford commented ...
I get the variable not defined happens on messages where there is no name defined, only an email address. Try it with a message that you know has both a name and email address for the recipient.

I think you will have to wrap a try block around the set name section.

Using a try block takes care of the error, but not the problem.
In some cases, I have found messages where 'name of theRecipient' does return a name.
In other cases, there is a name there because I can see it when I open the message, yet I get an error.
'name of theRecipient' even returns an error when I know there is a name there because the following script shows the name.


tell application "Mail"
    set msgList to (messages of mailbox "TEST")
    repeat with theMsg in msgList
        set theSub to subject of theMsg
        set theHead to headers of theMsg
        repeat with headItem in theHead
            name of headItem as text
            if the result = "to" then
                set recip to "To: " & content of headItem
            end if
        end repeat
        display dialog theSub & return & recip
    end repeat
end tell

This is beginning to look like a bug.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Replace names of files in different folders
  • Next by Date: Re: Replace names of files in different folders
  • Previous by thread: Re: Scripting Mail
  • Next by thread: Replace names of files in different folders
  • Index(es):
    • Date
    • Thread