Making a MIME addition for Zimbra in FireFox
I was looking for a way to “push” out a mime change to a number of users but didn’t have too much luck. I haven’t written the script out yet BUT I might post it when I’m done My working script / batch file for a user logon is posted below for your copying pleasure ;). In the meantime I did find the mechanism to update a users MIME type for mailto links in URL’s so if a user clicks on one it’ll prompt them which webmail client they want to use. The user can select it as their default mailto MIME type so when they click a mailto link it’ll open Zimbra.
First:
Find the mimeTypes.rdf file in your users (or your) profile directory. It’ll be something like: C:\Documents and Settings\%username%\Application Data\Mozilla\Firefox\Profiles\%profile%.default
* %username% is your computer username
* %profile% is your FireFox profile, it’s a random bunch of characters
Second:
Edit the mimeTypes.rdf with a text editor, here you’ll put in your Zimbra mail server information:
* Now you want to drop this anywhere in the file after a </RDF:Description> line since that’s the end of the previous entry and edit the bold pieces below
<RDF:Description RDF:about=”urn:handler:web:https://mail.yourserver.com/zimbra/?view=compose&to=%s”
NC:prettyName=”Zimbra”
NC:uriTemplate=”https://mail.yourserver.com/zimbra/?view=compose&to=%s” />
<RDF:Description RDF:about=”urn:mimetype:application/java-archive”
NC:value=”application/java-archive”
NC:editable=”true”
NC:fileExtensions=”jar”
NC:description=”Executable Jar File”>
<NC:handlerProp RDF:resource=”urn:mimetype:handler:application/java-archive”/>
</RDF:Description>
Restart Firefox if you have it open, then test your mailto at this site: http://www.scottseverance.us/mailto.html
You “should” be able to distribute this file to all your users
I made my batch file, you’d put this in the startup script for your users via group policy:
@echo off
:: Checking for FF directory and if FF is installed
if exist “%ProgramFiles%\Mozilla Firefox” goto FF
:: 64 bit machines have this directory
if exist “%ProgramFiles(x86)%\Mozilla Firefox” goto FF
echo FF is not installed…
:: Also note that this isn’t doing any 64 bit stuff, I think the MIME file is architecture agnostic
goto end
:FF
:: Changing directories to the default FF profile directory
cd %APPDATA%\mozilla\firefox\profiles
:: Listing their randomly named profile folder
dir “%APPDATA%\mozilla\firefox\profiles” /AD /B > %TEMP%\profile.txt
:: Setting a FF directory variable based on their folder name
set /p ffdir= <%TEMP%\profile.txt
:: Note
:: Error = 0 for true
:: Error = 1 for false
\\yourserver.domain\netlogon\filever.exe “%APPDATA%\mozilla\firefox\profiles\%ffdir%\mimeTypes.rdf” | findstr /C:”26,558″
:: If the file is the one we want, the one we edited skip it it’s equal in size “EQU”, if not it backs up the file and then copies the new one
if %errorlevel% EQU 0 goto end
ren “%APPDATA%\mozilla\firefox\profiles\%ffdir%\mimeTypes.rdf” mimeTypes.rdf.bkp
copy \\yourserver.domain\netlogon\mimeTypes.rdf “%APPDATA%\mozilla\firefox\profiles\%ffdir%\”
del /f /q %TEMP%\profile.txt
:: Troubleshooting pauses now commented out, uncomment to troubleshoot and see output
::pause
:end
:: pause
* You need to drop your mimeTypes.rdf that you edited on a network share, I have a generic fake one in the code \\networkshare\networkdrive\…
* Also check the “| findstr” section, your file might be a different size than mine when you edit it. When I edited my MIME file for FF that’s the size it gave it and it’s how I distinguish it from the default file that’s in that directory. This way, if the correct file exists we simply exit and move on.
* You’ll also need “filever.exe” <– Download it there ;)
References:
Batch file read text from a file: http://forums.techguy.org/software-development/551867-batch-file-read-line-text.html
FireFox MIME Type Modification: http://kb.mozillazine.org/MimeTypes.rdf
Another method on the Zimbra forums that “works” it’s just not “automated” in any way but got me thinking: http://www.zimbra.com/forums/developers/19314-support-firefox-3-mailto-protocol-handler.html#post106937
Finally – leave a comment if this helped you out, worked for you or COMPLETELY messed your system up :P
great ! I was looking for months this issue…. Thank you so much !!!!!!!!!!