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.
Pretty nice post. I just stumbled upon your blog and wanted to mention
that I’ve truly enjoyed browsing your weblog posts. After all I will be subscribing in your feed and I am hoping you write again soon!
I wouldn’t touch zimbra’s mailto link handling until they fix the bugs with broken links – http://www.zimbra.com/forums/administrators/57555-mailto-links-getting-cut-webgui.html#post244951
Atm it looks like the Zimbra guys abandoned the forums and don’t care about bugs any longer either.