Yesterday, I wrote a quickie script to scan Mail's mailboxes to determine if mailboxes need rebuilding. The test is to compare the message count with the file count in the /Users/<username>/Library/Mail/.../Messages/ folder. If they are not equal, the mailbox needs rebuilding. The source of this problem is ...
tell application "Mail" to delete msg
which does move the message and its associated file into the Trash mailbox, but leaves a copy of the .emlx file in the original Messages folder.
I tried to fix this with ...
tell application "Mail" to move msg to trash mailbox
or
tell application "Mail" to move msg to (trash mailbox of frontViewer)
But this DOES NOT move anything. I've tried all sorts of variations on this theme, and 'move' does not move anything. Perhaps I haven't got the syntax exactly right, but it seems to comply with the dictionary.
Does anyone know more? (If its a bug, I guess it should be reported.)