in applescript script: Find selected messages in Fastmail

For Fastmail users who also use, here’s a script that searches for the selected messages (in in the Fastmail web interface.

Why would you need such a thing? One reason is that Fastmail lets users specify an infinite number of aliases which they can give to an infinite number of websites (and subsequently block, if an infinite amount of spamming ensues). doesn’t offer a good way to change your reply address, but replying from the Fastmail web interface does the trick nicely. (Thunderbird users can use the Virtual Identity plugin for this as well.)

Here’s the script:

--Searches for the messages selected in using the Fastmail web interface
--By Dan Byler (

tell application "Mail"
        set selected_messages to selection
        set remaining to count of selected_messages
        set the_url to "*;MSS=!MB-*;SMB-CS="
        repeat with the_message in selected_messages
            set remaining to remaining - 1
            set message_id to the message id of the_message
            set the_url to the_url & "msgid%3A%22" & message_id & "%22"
            if remaining > 0 then set the_url to the_url & "%20OR%20"
        end repeat
        set the_url to the_url & ";SMB-SearchAll=on;MSignal=*P-1"
        open location the_url
    end try
end tell

Or download it here.

For those with something to say:


  1. It’s really a cool and useful piece of information. I’m satisfied that you shared this helpful info with us. Please keep us informed like this. Thank you for sharing.

  2. I liked up to you’ll obtain performed proper here. The comic strip is tasteful, your authored material stylish. however, you command get bought an impatience over that you want be turning in the following. in poor health certainly come further in the past again since precisely the similar just about very regularly inside of case you defend this increase.

  3. Attractive section of content. I just stumbled upon your site and in accession capital to say that I get in fact loved account your blog posts. Anyway I will be subscribing to your feeds or even I success you get right of entry to persistently rapidly.