When you click on a mailto: link, most of the time your Firefox will launch that version of Outlook Express or Apple Mail you never configured. For the novice user, they click next, next, next, next, then send their e-mail…and it never gets delivered. Well using a greasemonkey script that we’ll convert to a firefox extension, we can handle the mailto links.
This morning, I clicked on a link thinking it would take me to a “Contact us” form, but it was a mailto: link. I was a little annoyed that Apple Mail opened, and I thought: I wonder if there’s a way to change that link to open ZCS?
Well, I found a cool little hack using GreaseMonkey and a site that compiles GreaseMonkey scripts to an xpi extension.
First, some pre-requisites:
You’ll need ZCS 4.5.0 or newer.
This is a Firefox only hack. Sorry IE and Safari users.
First, go to this URL:
http://userscripts.org/scripts/review/595?format=txt
This is a GreaseMonkey script for GMail. All we’re going to do is change the URL from GMail to your ZCS server. The script is licensed under GPL, and if you use it, please note that you MUST abide by the coder’s License guidelines. The script was written by Julien Couvreur.
Copy all of the text to your favorite text editor.
Now, in your text editor, you’re going to change a few lines.
Change:
# // ==UserScript==
# // @name Mailto Compose In GMail
# // @namespace http://blog.monstuff.com/archives/000238.html
# // @description Rewrites “mailto:” links to GMail compose links
# // @include *
# // @exclude http://gmail.google.com
# // ==/UserScript==
To:
# // ==UserScript==
# // @name Mailto Compose In Zimbra
# // @namespace http://blog.monstuff.com/archives/000238.html
# // @description Rewrites “mailto:” links to Zimbra compose links
# // @include *
# // @exclude http://mail.domain.com
# // ==/UserScript==
**Replace https and mail.domain.com with your server name.
and Change:
mailtoLink.href = “https://mail.google.com/mail?view=cm&tf=0″ +
(emailTo ? (”&to=” + emailTo) : “”) +
(emailCC ? (”&cc=” + emailCC) : “”) +
(emailSubject ? (”&su=” + emailSubject) : “”) +
(emailBody ? (”&body=” + emailBody) : “”);
// mailtoLink.onclick = function() { location.href = newUrl; return false; };
To:
mailtoLink.href = “https://mail.server.com/zimbra/h/search?action=compose” +
(emailTo ? (”&to=” + emailTo) : “”) +
(emailCC ? (”&cc=” + emailCC) : “”) +
(emailSubject ? (”&subject=” + emailSubject) : “”) +
(emailBody ? (”&body=” + emailBody) : “”);
// mailtoLink.onclick = function() { location.href = newUrl; return false; };
**Be sure to replace https with http or https (depending on if you use SSL). Also, be sure to replace mail.server.com with your Zimbra server address.
Now, go to this website:
http://arantius.com/misc/greasemonkey/script-compiler
And fill in the text areas. Leave the GUID the same, and copy and paste your new script into the script text area, then hit compile.
It will ask you to save the xpi file. Once you save it, Open Firefox, then click file->Open and locate your XPI. Restart firefox, and all of your mailto: links now point to the Zimbra server.
Thanks and credit go to:
Julien Couvreur who wrote the script
Anthony Lieuallen for the web based GreaseMonkey to Firefox Extension converter
cubicgarden for the flickr GreaseMonkey photo.
Gmailâ„¢ webmail service is a registered trademark of Google, Inc.
Firefox is a registered trademark of Mozilla, Inc.
Also, these sites and scripts are not hosted or affiliated with Zimbra or Yahoo.


on November 28th, 2007 at 3:29 am
Update the registry as follows:
[HKEY_CLASSES_ROOT\mailto\shell\open\command]
@=”\”C:\\Program Files\\Internet Explorer\\iexplore.exe\” http://myserver/?app=mail&view=compose&to=%1”
where myserver is the zimbra server.
This could be saved in a mailto.reg text file as:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\mailto\shell\open\command]
@=”\”C:\\Program Files\\Internet Explorer\\iexplore.exe\” http://myserver/?app=mail&view=compose&to=%1”
On login we could run regedit /s mailto.reg to update a users mail to web links.
on November 28th, 2007 at 7:40 am
Hey Padraig,
Good job. I was going to blog about that today!
I’m having to hold off because the %1 parm seems to be passing mailto:address@zimbra.com into the to field.
How did you get around that?
john
on November 28th, 2007 at 10:06 am
You could do this with Webmailer.app on OSX.
Install -> http://belkadan.com/webmailer/
Then add a new webmail client as:
Zimbra -> https://mail.example.com/zimbra/h/search?action=compose&to=to&cc=cc&su=subject&body=body
Thanks,
Will
on December 21st, 2007 at 9:33 am
I know this isn’t tech support but… I was hoping someone could help a novice with this. I followed the instructions as best I could. And after installing the extension I get an Alert dialog on every page. The message is “Error: Illegal character”
on July 17th, 2008 at 7:59 am
Following hints and tips from Julien Couvreur on the comments on his blog, I moved to WebMailCompose (tracking down the FF3 version at http://soakedandsoaped.com/files/webmailcompose-0.6.7.xpi) which allows mailto: links to be handled in different webmail services. Zimbra is not configed by default, but http:///zimbra/h/search?action=compose&to=^T&su=^S&body=^M&cc=^C configed as other works ok.
Now for clean use (for end users just getting over Outlook) it would be great if this was in a new compose-only window rather than as new tab with a complete Zimbra loaded into it. Any hints as to a URL tweak that would load a popped out compose window?
Thanks
Chris