Using the AppleScript below I am unable to open the message ID. This same message ID is in a note in my Reminders app and clicking on the link works correctly there.
set emailID to "message://<DB43DAF1-7B87-4DE5-99DB-EC11CB0F6FF7@gmail.com>"
tell application "Mail"
open location emailID
end tell
I get the pop-up error
The operation couldn't be completed.
(MCMailErrorDomain error 1030.)
Mail was unable to open the URL "(null)".
I've researched that error code but the answers don't seem applicable. Also, when removing the word "location" from my AppleScript, Mail will open but with a blank new email.
Any help getting this script to actually open the email with that ID would be greatly appreciated.
Best Answer
Mail is not smart enough to just tell it to open a document by just its
message id
in the manner you're trying to do it. You need to tell Mail where to look for it, as in what mailbox it's in.The following example worked for me when
MessageID
was set to one in my Inbox using its propermessage id
however in this example I'm using themessage id
shown in your OP.Note that the example code above is limited in that it doesn't gracefully trap an error, so the example code below adds a
try
statement with anerror
statement to handle an error gracefully.