Belkadan Software

Webmailer 1.3

Ever click on a mailto: link, only to scream in frustration as Apple Mail opens yet again? The curse of the webmail user is that there is no way to get around this problem. That is, until now.

Webmailer is an unoriginally named program (actually a preference pane) for Mac OS X that allows you to fix this problem. You can set it to open any URL or run any shell script, complete with the parameters lifted from the mailto link.

Installation

  1. Double-click the Webmailer.prefPane icon to launch System Preferences and install Webmailer.
  2. Open the Webmailer preference pane and select "Webmailer" to handle mailto URLs.

Usage

Webmailer comes with several preset configurations for popular webmail systems. If you're using one of those, select it and click "Choose". Alternately, double-click next to your row in the column that displays which configuration is active. The green indicator should move to the row you want. If you are using a webmail program (e.g. SquirrelMail as opposed to Yahoo! Mail), you will need to change anything in CAPITAL LETTERS to match your actual mail website. You can find out what it should be by logging in to your mail and examining the URL.

If, on a certain occasion, you want to choose a different configuration from your default, just hold down the shift key when you click the mailto link. (If your browser takes a different action when the shift key is pressed, just click first and then hold the shift key.)

By default, Webmailer attempts to guess which browser to use to open your webmail program. If you want Webmailer to always use a specific browser, or to use your system default value, you can set this in the "Advanced" preferences.

Custom Configurations

If none of the default configurations match your webmail, you can make a new one by clicking the "Add" button. Enter a name, then press Tab to edit the destination field. This should generally be a URL, likely directed at the Compose page on your webmail site. You can use the following placeholders anywhere in the URL string; they'll be replaced with the appropriate parameters from the mailto link. (Keep in mind that your webmail site may not support all of them).

You can also use the following modifying forms. The word "to" here is merely an example; any parameter including ? will work.

URLs do have some reserved characters; if you want to put one of them in you should probably escape them using percent syntax. Note that this is only for characters in the literal URL; most of the time these don't matter for the parameters.

Good luck!

Shell Scripts

If you prefer, you can use a shell script instead of a URL — for example, to log all URLs you click on. (Why you'd want to do this is another story, but there are command-line-based mail programs). Anything that doesn't create a valid URL will be interpreted as a shell script and run in the Terminal. All parameters are still supported, and URL encoding is unnecessary. However, any quotes in the URL are automatically URL-encoded, so that quotes in your shell script will work as expected. It is suggested that you use single quotes around any placeholders in your script.

"But wait," you say, "I just wanted to log everything to a file. I didn't want to open the Terminal for that." That's easy. Just add a # to the very beginning of the line. (This would be interpreted as "comment" in most shells, so it won't make any commands impossible to run). The resulting command, which might look something like this: "#echo [to] >> ~/mailto.txt", will run without the Terminal opening at all.

If you just want to open a file or application (as if you had clicked on it in the Finder) you can either use a file URL:

file:///Applications/Mail.app

or a shell script:

open /Applications/Mail.app

But neither one will allow you to pass parameters to the program or file, so it's a lot less useful than it might seem. Instead, you can use an AppleScript to pass parameters to a given app:

#osascript -e 'tell application "Mail"' -e 'GetURL "mailto:[to]?[?]"' -e 'activate' -e 'end tell'

But if you were actually going to use Mail, you wouldn't have downloaded Webmailer, right?

AppleScript

Webmailer includes basic AppleScript support. Destinations can be accessed by name, and have an additional URL property. Currently you cannot add or delete destinations via AppleScript, but you can set the active destination as shown below:

tell application "Webmailer"
    set active destination to destination "Apple Mail"
end tell

Notes

Why are there two SquirrelMail modes?
Unfortunately, some SquirrelMail accounts don't seem to support mailto.php (the first mode). For these, you'll have to make do with SquirrelMail 2, which directly opens the composition page but doesn't have the sidebar.
It's not working.
Well, that's not a great way to ask questions, but even so, the most likely problem is that you didn't enter the URL correctly. If it still doesn't work, you can try changing all of the [parameter]s to [%parameter]s. If it still doesn't work, you can always send your specific problem to Belkadan Software.
If it's one of the default URLs that doesn't work, and you haven't modified it (beyond putting in your site's addres, if applicable), please notify me so that I can fix it quickly. Not having certain programs made it difficult to test some of these.
Why didn't you include webmail client X?
Obviously the default list of webmail clients can't be infinite, and Webmailer includes some of the top choices for webmail programs. However, if you have a client you think should be on the default list that ships with Webmailer, please tell me. (It is also more helpful if you can figure out the destination URL, rather than making me do it).
In addition, more destination URLs are available at http://belkadan.com/webmailer/destinations.

Uninstall

If you want to uninstall Webmailer (for whatever reason), just control-click its icon in the "Show All" view of System Preferences and choose to remove it. The default mail handler should revert to Apple Mail; if it doesn't, try emptying the Trash (where the preference pane usually ends up).

Contact

webmailer@belkadan.com: Bugs, requests, questions, new destination URLs? E-mail me!
belkadan.com: Get more great programs from Belkadan Software!

Copyright © 2012 Jordy Rose