I have had mail scripts working for years. Since an upgrade I can’t get the simplest script to work.
tell application "Mail"
set this_message to selection
set x to content of this_message
end tell
and using Apples own mail rule script
tell application "Mail"
set this_message to selection
try
set this_content to (every character of content of this_message) as Unicode text
if this_content is in {"", "?"} then error
on error error_message
set this_content to "NO CONTENT"
end try
end tell
Both fail. I am sure its me being thick but I can anyone help please
Model: iMac 3.5 GHz i7
Browser: Safari 601.5.17
Operating System: Mac OS X (10.10)
Hi,
take a look at the dictionary of Mail.app to see what selection returns…
Read thick. Thanks Stefan,
script only works on Applemail though
when To: me@mac.com
tell application "Mail"
set this_message to selection as list
set x to content of item 1 of this_message
end tell
returns
"“StefanK has replied to the topic ‘Simple mail script not working in El Capitan’ to which you are subscribed. There may be more new replies, but this is the only notification you will receive until you visit the board again.
The post is located at http://macscripter.net/viewtopic.php?pid=185439#p185439”
but when To: me@myserver.com (pop account)
it errors out
error “Mail got an error: Can’t get mailbox "INBOX" of account "Retouching Requests".” number -1728 from mailbox “INBOX” of account “Retouching Requests”
A reply to my previous post.
I have just upgraded to El Capitan.
In its wisdom I now discovered that it created IMAP accounts of all my POP3 accounts but did not enable them.
When the applescript tried to access a selected POP3 account it threw the error that is “Mail got an error: Can’t get mailbox "INBOX" of account "Retouching Requests".” number -1728 from mailbox “INBOX” of account “Retouching Requests” because I assume its looked at the IMAP account first, which actually does not exist?!?!
I have now deleted the bogus IMAP accounts and it all works fine.