edmullen dot net

MAIL TO - Getting the mailto: url to work with Mozilla and Windows - Thanks to Mike Cowperthwaite for his input on various issues for this page!

Getting the mailto: link to work as desired depends on several factors and there are numerous possible permutations. Here are a few.

See RELATED BUGS at Bugzilla

COMMENTS

In August 2004 I revised this page to reflect some changes in the newer Mozilla versions. I've tested various configurations and read many Bugzilla reports and have come to the conclusion that this functionality is still not working properly. I finally got tired of trying different permutations and gave up. The only situation I can use reliably is:

However, I've posted the information below because differences in my system configuration may be causing problems with some situations here that might not be an issue on other peoples' systems. Bottom line? Try some different scenarios and see what happens.


Basic Setup

1. Put the following two lines into the user.js file in your profile folder:

// needed to make mailto urls work

user_pref("network.protocol-handler.external.mailto", false);

This option applies only to the Mozilla browser, and assumes Mozilla Mail/News as the default mail client. If you want to send the mailto: link to an external client (Thunderbird, Eudora, etc), set the option to True. The option is unused for Firefox, and also unused if the suite install does NOT include Mail/News, since those situations always assume an external mail client.

2. Set the Windows file association for the URL:MailTo Protocol.

Explanation of the command:

IN MOZILLA 1.8 - "x:\Program Files\mozilla.org\Mozilla\mozilla.exe" -nosplash -compose -P "yourprofile" %1

IN MOZILLA 1.5 thru 1.7 - "x:\Program Files\mozilla.org\Mozilla\mozilla.exe" -nosplash -browser -P "yourprofile" %1

IN MOZILLA 1.4 and earlier - "x:\Program Files\mozilla.org\Mozilla\mozilla.exe" -nosplash -mail -P "yourprofile" %1

These commands will open a compose window but may also open a "ghost" window -- an uninitialized browser window (bug 204752).


SCREEN SHOTS

shot1

shot2


ALTERNATE METHOD

I received this from Adam Giese. It involves using a custom batch file to implement the mailto function. I have not tested it extensively but it does seem to work as advertised. Thanks to Adam for contributing this.


Subject: your mozilla mailto: page
From: Adam Giese
Date: Fri, 26 Dec 2003 02:17:39 -0600

http://edmullen.net/mozilla/moz_mailto.php

After trying to figure out the registry & command line options myself to get e-mail links outside of Mozilla to properly work without much success, I searched around the internet and was directed to your page which confirmed my frustrations. Still desperately needing a solution, I did some more searching on batch file syntax and came up with this file I call mozmail.bat that will get Mozilla Mail to behave the way I want it to, and may be an aid to your site as well.

@echo off
rem mozmail.bat
rem by Adam Giese
rem
set opt1=%1
if %opt1%==b goto execute
set string=%2
set string=%string:"=%
set string=%string:?= %
c:\docume~1\adam\mozmail.bat b %string%
:execute
set string=%2
c:\progra~1\mozilla.org\mozilla\mozilla.exe -compose "to=%string:~7,90%"

Copy that text into a file and place it somewhere you can find it on your system. Make sure to modify the two paths within the .bat file to reflect what your system has. And yes, the .bat file does indeed call itself.

Then find in the registry:

HKEY_CLASSES_ROOT\mailto\shell\open\command\

and there is a key called "(default)", make the value of that (again, change the path for your system accordingly):

C:\docume~1\adam\mozmail.bat a "%1"

And you're set!

From outside of Mozilla, this would strip off any pre-set subject or body data.

From within Mozilla, mailto: links still act normally.

Have fun!

Adam Giese


This page last changed: Sunday, July 26, 2015 - 12:49 PM USA Eastern Time

Copyright Ed Mullen | Contact Ed

click for home page