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}
            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'?


  • did you try using the delay x
    – Ruskes
    Commented Oct 23, 2014 at 6:38
  • I did in a few places to prevent multiple messages from throwing mail server errors if sent too fast, but removed them again as it seems fine now. Where would delay help in this instance though?
    – fastasleep
    Commented Oct 23, 2014 at 8:38
  • Another thing I've noticed, is that I can close them (not send) and they'll clear out the same way.
    – fastasleep
    Commented Nov 25, 2014 at 9:02

1 Answer 1


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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .