AppleScript-sent messages pop up as unsent drafts when trying to quit Mail I have a spam processing script that I use to forward spam messages as attachments to my spam filter using the 'send' command in AppleScript. Everything processes and delivers fine, but later when I go to quit Mail, I'll have a new message window pop up with one of the messages that was sent in its own window as if it were a draft I was working on.

If I manually send it again, it will do the same with the next message that I had sent with the script, over and over until all of the ones since last open have reappeared. After the last one is re-sent or closed, Mail quits fine. They aren't being stored in my Drafts folder up to this point.

Here's the relevant part of the script:

        tell application "Mail"
            set theNewMsg to make new outgoing message with properties {subject:theReportSubject, visible:true}
            tell theNewMsg
                make new to recipient at end of to recipients with properties {address:theAddress}
                make new attachment at after the last paragraph with properties {file name:theTempFileName}
                send
            end tell
        end tell


I've tried visible:true and visible:false and don't see the message appear either way, I assume because it's processed so fast. Is there something I should be doing after 'send'?

Thanks!
D'oh! Finally figured it out, and it's all my fault. Setting visible:true is the key. The problem was that I was always editing the original scripts in my ~/Library/Scripts/ folder, but testing them by using the hot key I set up to trigger...duh...the Automated workflow files in ~/Library/Services, which I had not updated.

Posting an answer in case someone else does something as dumb as I was doing. /headdesk