Default Mail Applications (mailto reprised)

By | November 28, 2007

We’ve had some great responses to my blog post yesterday about changing the default mailto links using Firefox. There’s a couple of problems with my method: 1) It’s not really scalable for an admin [ie no auto install] 2) Not really applicable for Safari and Internet Explorer.


I found that there are many different ways to change the default mail handler in windows.

I decided to set out on a journey that would last me most of the night, and this morning testing most of the different methods in Parallels.

As I said, the largest problem with yesterday’s tutorial was that it isn’t easily scalable. Most admins don’t to walk around to each PC, and install Firefox, then install the Firefox extension we talked about yesterday. The most dominent browser and operating system is is Internet Explorer and Windows, and we really do have to play by their rules. The most obvious solution for Windows users is to have a registry file that you can import.

Since Firefox, IE, and Safari all handle the mailto URI call based upon what’s in the registry, we need to go that route. However, it does cause one small usability problem (we’ll cover that later).

For all of you administrators running a Microsoft Windows NT-based Domain, I’m sure you’re familiar with the technique of executing login scripts for your users. If not, I strongly suggest you read this tutorial. It’s a little off topic, but as an admin, I found it very valuable.

The cool thing about this registry hack, as paradiag points out, is that you can set up a script to silently import this registry file upon login. This allows you to modify most, if not all, of you clients on a single login. Simply run:

regedit /s zimbra.reg

Here’s the registry file. Make sure you save it, and not run it quite yet. You’re gonna need to modify these keys to fit your enviroment:

[HKEY_LOCAL_MACHINESOFTWAREClientsMailZimbra Web ClientDefaultIcon]
@="c:\windows\zimbra.ico"

[HKEY_CURRENT_USERSoftwareClassesmailtoDefaultIcon]
@="c:\windows\zimbra.ico"

[HKEY_LOCAL_MACHINESOFTWAREClientsMailZimbra Web Clientshellopencommand]
@="rundll32.exe url.dll,FileProtocolHandler https://mail.server.com/h/"

[HKEY_CURRENT_USERSoftwareClassesmailtoshellopencommand]
@="rundll32.exe url.dll,FileProtocolHandler https://mail.server.com/h/search?action=compose&to=%1"

Make sure you change the URL to direct the users to your mail server. Next, you have two options: You can direct them to the Ajax Client or the Standard Client. Because the Standard Client is much faster, I have that URL scheme already in the registry file. If you want to use the AJAX client, then use:

https://mail.server.com/zimbra?app=mail&view=compose&to=%1

I created a cool icon for you. Download the reg file and ICO file in this zip. It’s already in ICO format which is supported by Windows 2000+. In your login script, you’ll need to copy that icon to a location on the local user’s hard drive. Where ever you place that file, make sure you reflect that location in the above registry keys.

This is cool, but I found one problem with it. The %1 in the URL is a variable for what ever string the browser passes to your application. In this case, it will pass mailto:username@domain.com

This is a problem because the URL ends up being:

https://mail.server.com/zimbra?app=mail&view=compose&to=mailto:username@domain.com

This causes the URL to pass mailto: into the prepopulated to: field. And if you take off &to, it doesn’t work at all. Does any one have any idea how we can remove mailto: from being passed to the %1 variable?

Other than that, it works great :)

On Mac, you may want to try out http://belkadan.com/webmailer/

I didn’t install it, but from what I hear it works great.


Comments

  • How come this is still not available in the zimbra desktop client?

    Can we do the same thing but point it to the localhost and port of the zimbra desktop client?

    Commented on July 20, 2010 at 2:04 pm
  • Hi John,

    your reg hack didn’t work here. Reason stays unclear…

    Commented on November 3, 2010 at 5:57 pm
  • This does not work on Windows 7 and I’d realllly like it to. Any updates?

    Commented on January 27, 2012 at 7:19 pm
  • If you could have a little routine examine the string, and see if the first seven characters are in fact “mailto:”, and then trim those seven characters off and modify the variable that’s being sent…

    … That would trip up in scenarios where someone legitimately has an email address that starts with “mailto:”, but is the colon even a valid character in an email address? Or someone with “mailto:” in their actual name, for some reason. I think those scenarios would be pretty rare, though.

    Commented on May 9, 2012 at 9:20 pm