Deleting Mail Messages with Applescript - They stay in Inbox?
This seems a little strange. I have an applescript that I run on some messages to train the bayesian spam filter on my IMAP (non-Google) account, and one of the towards the end it uses the Applescript delete command to delete the message:
tell application "Mail"
(* other stuff here *)
set theSelection to selection
set theMessage to item 1 of theSelection
deletetheMessageend tell
When I then look at the account on another mail client (say, my phone), the messages do appear in the Trash folder, but they are also still in the Inbox, too. It's like Mail only sent a copy command, or forgot to tell the server to remove the message from the Inbox. This is true even if I run a "synchronize" command from mail.
Then, when I quit Mail and restart (or put the computer to sleep overnight), the messages also re-appear in the Inbox there.
I don't see this behavior if I delete the messages personally in Mail, it only occurs with the applescript delete command.
Is there something I'm missing from the script? Or is there some better way to delete a message using IMAP?
iMac (21.5-inch Late 2009), OS X Mavericks (10.9.2)