I am receiving an error message ---

error "Mail got an error: AppleEvent handler failed." number -10000 when I run the following AppleScript.
The variable theEmailAddresses contains the correct email address from the first in the group per the log command. I am new to AppleScript. The subject and body fills correctly. Any help would be appreciated.
tell application "Address Book"
          set ps to every person in group "Weekly"
          repeat with i from 1 to (count every person)
  set theEmailAddresses to value of email of person i
                    log "EMail Address " & theEmailAddresses & " " & i
                    --delay 10
                    tell application "Mail"
                              set theNewMessage to make new outgoing message with properties {subject:"Weekly Specials", content:"Case of Oil", visible:true}
                              tell theNewMessage
                                        make new to recipient at end of to recipients with properties {address:theEmailAddresses}
  --delay 15
                                        send
                              end tell
                              --delay 10
                    end tell
  end repeat
end tell

You should probably put it in a try statement to get a little more detail.  My guess is theEmailAddress may contain unicode text or text that chokes the script (like joe blow [[email protected]]). 
So one thing to try is
set theEmailAddresses to the value of (email of person i as string)
or
set theEmailAddresses to the value of (email of person i as unicode text).
You can use "say" to help debug.
set theEmailAddresses to the value of email of person i
tell me to say "class of email address is " & class of theEmailAddress as string
In general if you put
tell application "Address Book"
     try
          your-script-body
     on error eStr number eNum partial result rList from badObj to expectedType
          log eStr &  " (" & eNum as string & ") " & rList as string & " " & expectedType as string
     end try
end tell
After all that, though, I can tell you I get this error too and have learned to put nothing in the on error section and just keep trying to plug ahead.  For example, in the sample mail rule script that Apple ships, I get about 1 of 4 of these trying to retrieve id of mail message.

Similar Messages

Maybe you are looking for

  • Data Conversion Error Message

    I am getting the following error when running a report in Crystal Reports 2008: 'Database Connection Error: '42000:[Microsoft][ODBC SQL Server Driver][SQL Server]Error converting data type varchar to datetime. [Database Vendor Code: 8114 ]' I can run

  • Windows Integrated Authentication on an ABAP data source

    Dear Experts, I have to implement Windows Integrated Authentication in my portal. By using Kerberos & SPNEGO, we can implement very easily if portal user id & windows (ADS) user id is same. But my scenario is windows id & portal id is different & dat

  • Upgrade tool HE to HFM

    Hi all, is there any tool to upgrade from HE to HFM? It's a very simple HE application (very flat) Thanks in advance

  • How to automatically open date/time field (calendar) when end user tabs to that field

    Have two calendar fields...calendar 1 and calendar two Is there a way to have the calendars automatcally open when field is either clicked on or tabbed to? thanks

  • Reallocation of void check. to another payment document

    Hi Friends, I have an isse. Our customer has allocated the check to wrong payment document and she wants to reverse the document and allocate the same check number to another payment document number. when i reverse the payment document sysytm is tell