Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
how to make mailto: links work with firefox and thunderbird
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
dju`
Retired Dev
Retired Dev


Joined: 11 Feb 2003
Posts: 370

PostPosted: Mon Mar 29, 2004 9:02 pm    Post subject: how to make mailto: links work with firefox and thunderbird Reply with quote

another thread about this, but i get it working. this is taken from the mozillazine forums.

i'm using:
Code:
mozilla-firefox-0.8
mozilla-thunderbird-0.5-r1


1. install the mozex extension for firefox

get it from http://mozex.mozdev.org. currently i have mozex 1.07 installed.

in the mozex options, enable the intercept mailto: clicks. then set the mailer: command to the full path of a script, let's say, "/home/me/usr/bin/mailtoFirefoxThunderbird.sh %a %s".

2. create the /home/me/usr/bin/mailtoFirefoxThunderbird.sh script

open your favorite editor and copy/paste:

Code:
#!/bin/sh
export MOZILLA_FIVE_HOME="/usr/lib/MozillaThunderbird"
THUNDERBIRD_PATH=${MOZILLA_FIVE_HOME}
                                                                                                               
if [ -z "`/bin/ps x | /bin/grep \"[0-9] ${THUNDERBIRD_PATH}/thunderbird-bin\"`" ]; then
        # No MozillaThunderbird running
        ${THUNDERBIRD_PATH}/thunderbird -P default -compose "mailto:$1?subject=$2"
else
        # MozillaThunderbird running
        ${THUNDERBIRD_PATH}/thunderbird -remote "mailto($1?subject=$2)"
fi


save it to /home/me/usr/bin/mailtoFirefoxThunderbird.sh, and make it executable:

Code:
chmod +x /home/me/usr/bin/mailtoFirefoxThunderbird.sh


3. restart firefox

4. test

me@nowhere.com. i suggest you to test a link with a ?subject part. sorry, i wasn't able to reproduce a test link here with bbcode.

it should work now. the only thing we need is to get rid of the annoying mailto: is not a registered protocol message, which happens from times to times; however the compose window opens all the same. any suggestions and corrections are welcome, hope this helps.
Back to top
View user's profile Send private message
rentonj7
n00b
n00b


Joined: 18 Mar 2004
Posts: 48
Location: Stroudsburg, Pa

PostPosted: Tue Mar 30, 2004 4:49 am    Post subject: Reply with quote

thanks for this one dJu`
Back to top
View user's profile Send private message
Bastux
Guru
Guru


Joined: 15 Dec 2002
Posts: 369
Location: France - Paris

PostPosted: Tue Mar 30, 2004 9:13 am    Post subject: Reply with quote

Thanks Dju`

You can do the same with sylpheed :)

install the mozex extension, enable the intercept mailto: click, and instead of MozillaThunderbird script, type :

Code:

sylpheed-claws --compose %a


at the mailer: command line.
Back to top
View user's profile Send private message
mr.twemlow
Tux's lil' helper
Tux's lil' helper


Joined: 12 Nov 2003
Posts: 90
Location: Illinois

PostPosted: Wed Mar 31, 2004 5:21 am    Post subject: Reply with quote

For those of you who don't like adding extensions to firefox, here's how I did it:

Edit (or create) /home/username/.phoenix/DEFAULT/STRINGOFCHARACTERS/user.js

My file is /home/jef/.phoenix/default/nu0owawp.slt/user.js

Add the line

Code:
user_pref("network.protocol-handler.app.mailto", "/home/jef/scripts/mailto");


Where /home/jef/scripts/mailto is the path to the script above. But I had to edit the script to prevent it from putting mailto:name@name.com in the address instead of just name@name.com

How I did it is below, letting the html do the work of specifying address/subject/cc or whatever. Works fine for me:

Code:

#!/bin/sh
export MOZILLA_FIVE_HOME="/usr/lib/MozillaThunderbird"
THUNDERBIRD_PATH=${MOZILLA_FIVE_HOME}
                                                                                                               
if [ -z "`/bin/ps x | /bin/grep \"[0-9] ${THUNDERBIRD_PATH}/thunderbird-bin\"`" ]; then
        # No MozillaThunderbird running
        ${THUNDERBIRD_PATH}/thunderbird -P default -compose "$1"
else
        # MozillaThunderbird running
        ${THUNDERBIRD_PATH}/thunderbird -remote "$1"
fi

_________________
Get Gentoo icons: http://boxturtleme.2ya.com/gentoo-icons.xml

Gentium--A typeface for the nations: https://forums.gentoo.org/viewtopic.php?p=1351563
Back to top
View user's profile Send private message
NewBlackDak
Guru
Guru


Joined: 02 Nov 2003
Posts: 512
Location: Utah County, UT

PostPosted: Wed Mar 31, 2004 7:32 pm    Post subject: Reply with quote

Just an FYI. If you want Thunderbird to open weblinks you need a second script with
Code:
#!/bin/sh
export MOZILLA_FIVE_HOME="/usr/lib/MozillaFirefox"
FIREFOX_PATH=${MOZILLA_FIVE_HOME}
                                                                                                               
if [ -z "`/bin/ps x | /bin/grep \"[0-9] ${FIREFOX_PATH}/firefox-bin\"`" ]; then
        # No MozillaFirefox running
        ${FIREFOX_PATH}/firefox -P default "$1"
else
        # MozillaFirefox running
        ${FIREFOX_PATH}/firefox -remote "openurl($1, new-tab)"
fi


and to add the lines
Code:
user_pref("network.protocol-handler.app.http", "~/scripts/http");
user_pref("network.protocol-handler.app.https", "~/scripts/http");

to your Thunderbird prefs file
_________________
Gentoo systems.
X2 4200+@2.6 - Athy
X2 3600+ - Myth
UltraSparc5 440 - sparcy


Last edited by NewBlackDak on Thu Apr 01, 2004 6:33 am; edited 1 time in total
Back to top
View user's profile Send private message
mr.twemlow
Tux's lil' helper
Tux's lil' helper


Joined: 12 Nov 2003
Posts: 90
Location: Illinois

PostPosted: Wed Mar 31, 2004 10:52 pm    Post subject: Reply with quote

Thanks for the tip. I was just wondering how to do that.

mr.twemlow
_________________
Get Gentoo icons: http://boxturtleme.2ya.com/gentoo-icons.xml

Gentium--A typeface for the nations: https://forums.gentoo.org/viewtopic.php?p=1351563
Back to top
View user's profile Send private message
dhurt
Apprentice
Apprentice


Joined: 14 May 2003
Posts: 278
Location: Davis, CA

PostPosted: Sat May 08, 2004 8:17 pm    Post subject: Reply with quote

Thanks for the tips. This is exactly what I was looking for.

8)
_________________
"And isn't sanity really just a one-trick pony, anyway? I mean, all you get is one trick, rational thinking, but when you're good and crazy, ooh ooh ooh, the sky's the limit!" -- The Tick
Back to top
View user's profile Send private message
allucid
Veteran
Veteran


Joined: 02 Nov 2002
Posts: 1314
Location: atlanta

PostPosted: Sat May 08, 2004 8:40 pm    Post subject: Reply with quote

To open a link from an email in thunderbird with firefox:

~/.thunderbird/default/<random crap>/user.js (create this file if it doesn't exist)
Code:
user_pref("network.protocol-handler.app.http", "/usr/bin/firefox");


[edit] made a little more clearer


Last edited by allucid on Mon May 10, 2004 10:41 pm; edited 3 times in total
Back to top
View user's profile Send private message
TriKster_Abacus
n00b
n00b


Joined: 10 May 2004
Posts: 8
Location: USA

PostPosted: Mon May 10, 2004 7:04 pm    Post subject: Thunderbird to open weblinks Reply with quote

Hello,

I did the setup as described in the posts found here. I can open a URL in Thunderbird.. it opens firefox, but the address bar shows the url being a link in the /tmp directory, not the url address of the website I clicked on.

So in the /tmp generated webpage made by clicking the link you cannot go past the first link you clicked on in the email message.

Is there a way around this? To get firefox to open a new webpage with the full url, so I can use all the links and the webpage as it really stands?

Thank you

Sincerely,

TriKster Abacus
_________________
http://www.linux-militia.net | For Linux gamers
Back to top
View user's profile Send private message
allucid
Veteran
Veteran


Joined: 02 Nov 2002
Posts: 1314
Location: atlanta

PostPosted: Mon May 10, 2004 7:18 pm    Post subject: Re: Thunderbird to open weblinks Reply with quote

TriKster_Abacus wrote:
Hello,

I did the setup as described in the posts found here. I can open a URL in Thunderbird.. it opens firefox, but the address bar shows the url being a link in the /tmp directory, not the url address of the website I clicked on.

So in the /tmp generated webpage made by clicking the link you cannot go past the first link you clicked on in the email message.

Is there a way around this? To get firefox to open a new webpage with the full url, so I can use all the links and the webpage as it really stands?

Thank you

Sincerely,

TriKster Abacus


look at my post directly above yours. :P if you don't have a user.js just create one and put that line in it.
Back to top
View user's profile Send private message
dju`
Retired Dev
Retired Dev


Joined: 11 Feb 2003
Posts: 370

PostPosted: Mon May 10, 2004 7:48 pm    Post subject: Reply with quote

yeah, actually it's another problem from what this thread was initially about, but it's good to mention.
Back to top
View user's profile Send private message
firephoto
Veteran
Veteran


Joined: 29 Oct 2003
Posts: 1612
Location: +48° 5' 23.40", -119° 48' 30.00"

PostPosted: Sun Jun 13, 2004 10:02 am    Post subject: Reply with quote

Since I've been schooling myself on "101 ways to launch mozilla flavored apps" I figured I'd get my mailto: working without an extension.

This script will work with a default emerge of mozilla-thunderbird-bin. Just put it somewhere and make it executable and set your "network.protocol-handler.app.mailto" in about:config. It works if thunderbird is open, closed, doing something, whatever.
Code:

#!/bin/sh
#set -x # Uncomment "set -x" for debugging

export MOZILLA_FIVE_HOME="/opt/MozillaThunderbird"

#check if command line arguments have the form "mailto:somebody at somewhere.com?subject=something"
#if that's true put "somebody at somewhere.com?subject=something" in MAILTO address
MAILTO=`echo $@ | awk 'BEGIN{FS=":"} $1 ~ /mailto/ {print $2}'`

THUNDERBIRD_PATH="/opt/MozillaThunderbird"

if [ -z "`ps x | grep \"[0-9] ${THUNDERBIRD_PATH}/thunderbird\"`" ]; then
    # No thunderbird running
    /opt/MozillaThunderbird/thunderbird $@
else
    # thunderbird running - raise window
     /opt/MozillaThunderbird/thunderbird -remote "xfeDoCommand(openInbox)"
fi

if [ -n "$MAILTO" ]; then
    /opt/MozillaThunderbird/thunderbird -remote "mailto($MAILTO)"
fi



*edited it so it should be a drop in replacement for the /usr/bin/thunderbird script. Called on it's own, thunderbird launches, called again the window is brought to the top, called from the browser with mailto: the compose window opens. This is for the thunderbird-bin package but I imagine it should work with the compiled version with changes to the paths.

Thanks to google and
http://www.wlug.org.nz/MozillaThunderbirdNotes
Back to top
View user's profile Send private message
dhurt
Apprentice
Apprentice


Joined: 14 May 2003
Posts: 278
Location: Davis, CA

PostPosted: Sun Jun 13, 2004 4:22 pm    Post subject: Reply with quote

Works well, thanks. That is a better solution than the ones put out my the mozdev. Just a couple suggestions. You define a varible for the path to Thunderbird and then do not use it. A little pointless to setup the variable and then not use it :wink:. Also, I was under the impression that /usr/lib/MozillaThunderbird was the default location for the install. I did not change anything and that is where it is on my computer.

Code:

THUNDERBIRD_PATH="/usr/lib/MozillaThunderbird"

if [ -z "`ps x | grep \"[0-9] ${THUNDERBIRD_PATH}/thunderbird\"`" ]; then
        # No thunderbird running
        ${THUNDERBIRD_PATH}/thunderbird $@
else
        # thunderbird running - raise window
        ${THUNDERBIRD_PATH}/thunderbird -remote "xfeDoCommand(openInbox)"
fi

if [ -n "$MAILTO" ]; then
        ${THUNDERBIRD_PATH}/thunderbird -remote "mailto($MAILTO)"
fi

_________________
"And isn't sanity really just a one-trick pony, anyway? I mean, all you get is one trick, rational thinking, but when you're good and crazy, ooh ooh ooh, the sky's the limit!" -- The Tick


Last edited by dhurt on Mon Jun 14, 2004 1:53 am; edited 2 times in total
Back to top
View user's profile Send private message
BlindSpy
Apprentice
Apprentice


Joined: 20 Mar 2004
Posts: 263

PostPosted: Mon Jun 14, 2004 1:41 am    Post subject: Reply with quote

awesome work guys =)
Back to top
View user's profile Send private message
firephoto
Veteran
Veteran


Joined: 29 Oct 2003
Posts: 1612
Location: +48° 5' 23.40", -119° 48' 30.00"

PostPosted: Mon Jun 14, 2004 4:14 am    Post subject: Reply with quote

Your version (for a source install correct?) cleans it up a lot and should make for an easier patch for an ebuild depending on if it's the bin or source version. I emailed they person who did the current thunderbird (bin?) script so maybe this can get some wider testing.

Code:

#!/bin/sh
#set -x # Uncomment "set -x" for debugging

export MOZILLA_FIVE_HOME="/opt/MozillaThunderbird"

#check if command line arguments have the form "mailto:somebody at somewhere.com?subject=something"
#if that's true put "somebody at somewhere.com?subject=something" in MAILTO address
MAILTO=`echo $@ | awk 'BEGIN{FS=":"} $1 ~ /mailto/ {print $2}'`
#THUNDERBIRD_PATH="/usr/lib/MozillaThunderbird" #Uncomment for mozilla-thunderbird (source install)
THUNDERBIRD_PATH="/opt/MozillaThunderbird" #mozilla-thunderbird-bin

if [ -z "`ps x | grep \"[0-9] ${THUNDERBIRD_PATH}/thunderbird\"`" ]; then
    # No thunderbird running
    ${THUNDERBIRD_PATH}/thunderbird $@
else
    # thunderbird running - raise window
    ${THUNDERBIRD_PATH}/thunderbird  -remote "xfeDoCommand(openInbox)"
fi

if [ -n "$MAILTO" ]; then
    ${THUNDERBIRD_PATH}/thunderbird -remote "mailto($MAILTO)"
fi


I've never used mozilla-launcher so I don't know how this affects that.
Back to top
View user's profile Send private message
dhurt
Apprentice
Apprentice


Joined: 14 May 2003
Posts: 278
Location: Davis, CA

PostPosted: Mon Jun 14, 2004 6:06 am    Post subject: Reply with quote

Works fine here so far. Have not had any problems with it.

:D
_________________
"And isn't sanity really just a one-trick pony, anyway? I mean, all you get is one trick, rational thinking, but when you're good and crazy, ooh ooh ooh, the sky's the limit!" -- The Tick
Back to top
View user's profile Send private message
pacman13
n00b
n00b


Joined: 18 Nov 2002
Posts: 58
Location: Austin, TX

PostPosted: Wed Jun 30, 2004 5:46 pm    Post subject: Reply with quote

Would it not be possible to use Gnome's built in "Preferred Applications" to do this? (or KDE's? .. but I'm using Gnome at the moment)

So far I have it -almost- working, just by putting this as my preferred mail reader:

Code:
thunderbird -remote "mailto (%s)"


the only problem is that the %s stays as a %s in the TO field, not as the e-mail address. There may or may not be a way around this, but it seems MUCH more elegant than scripts, etc...

I'll play with it more later when I'm home from work, and post results if I get it working.
Back to top
View user's profile Send private message
allucid
Veteran
Veteran


Joined: 02 Nov 2002
Posts: 1314
Location: atlanta

PostPosted: Wed Jun 30, 2004 7:05 pm    Post subject: Reply with quote

probably, but not everybody is using a DE. The script works well.
Back to top
View user's profile Send private message
NewBlackDak
Guru
Guru


Joined: 02 Nov 2003
Posts: 512
Location: Utah County, UT

PostPosted: Wed Jun 30, 2004 7:11 pm    Post subject: Reply with quote

pacman13 wrote:
Would it not be possible to use Gnome's built in "Preferred Applications" to do this? (or KDE's? .. but I'm using Gnome at the moment)

So far I have it -almost- working, just by putting this as my preferred mail reader:

Code:
thunderbird -remote "mailto (%s)"


the only problem is that the %s stays as a %s in the TO field, not as the e-mail address. There may or may not be a way around this, but it seems MUCH more elegant than scripts, etc...

I'll play with it more later when I'm home from work, and post results if I get it working.


Shouldn't you be using
Code:
thunderbird -remote "mailto ($1)"
?
_________________
Gentoo systems.
X2 4200+@2.6 - Athy
X2 3600+ - Myth
UltraSparc5 440 - sparcy
Back to top
View user's profile Send private message
msimplay
Apprentice
Apprentice


Joined: 20 Jun 2004
Posts: 161

PostPosted: Thu Jul 01, 2004 12:34 am    Post subject: Reply with quote

newbie alert :p

what should i name the script and where should i put it ?
Back to top
View user's profile Send private message
firephoto
Veteran
Veteran


Joined: 29 Oct 2003
Posts: 1612
Location: +48° 5' 23.40", -119° 48' 30.00"

PostPosted: Thu Jul 01, 2004 3:49 am    Post subject: Reply with quote

I just put mine in /usr/bin/ and made it executable and I have mine named "thunderbird-mailto" and use it for any program, icon, etc that needs thunderbird. Just don't name it thunderbird or thunderbird-bin because an emerge will overwrite it.
Back to top
View user's profile Send private message
msimplay
Apprentice
Apprentice


Joined: 20 Jun 2004
Posts: 161

PostPosted: Thu Jul 01, 2004 7:02 pm    Post subject: Reply with quote

firephoto wrote:
I just put mine in /usr/bin/ and made it executable and I have mine named "thunderbird-mailto" and use it for any program, icon, etc that needs thunderbird. Just don't name it thunderbird or thunderbird-bin because an emerge will overwrite it.


thanks for that but what executes the script ?
because firefox is relying on kde to handle mailto
so do i set kde to launch the sh script when mailto link is clicked ?
Back to top
View user's profile Send private message
firephoto
Veteran
Veteran


Joined: 29 Oct 2003
Posts: 1612
Location: +48° 5' 23.40", -119° 48' 30.00"

PostPosted: Thu Jul 01, 2004 7:15 pm    Post subject: Reply with quote

enter about:config in the address bar of firefox and look for:

network.protocol-handler.app.mailto

and set that to:

/usr/bin/thunderbird-mailto (or wherever/whatever you called it)

You can also make a file named user.js in your firefox profile directory.
~/.mozilla/firefox/default.***/user.js

Code:
user_pref("network.protocol-handler.app.mailto", "/usr/bin/thunderbird-mailto");


The second way is probably the "better" way but both should work. (I use the first)

*Oh and I'm not sure how you are getting KDE to handle the mailto with firefox?? If you have something set their that firefox is linked to you might disable it or clear it or??
Back to top
View user's profile Send private message
kamagurka
Veteran
Veteran


Joined: 25 Jan 2004
Posts: 1026
Location: /germany/munich

PostPosted: Thu Jul 08, 2004 1:52 pm    Post subject: Reply with quote

amazing; finally firefox and thunderbird talk to each other (mind you, why they don't out of the box at least via the mozilla-laucher thing is beyond me).
_________________
If you loved me, you'd all kill yourselves today.
--Spider Jerusalem, the Word
Back to top
View user's profile Send private message
stoffe
n00b
n00b


Joined: 13 Mar 2004
Posts: 45

PostPosted: Fri Jul 09, 2004 12:07 pm    Post subject: Reply with quote

allucid wrote:
To open a link from an email in thunderbird with firefox:

~/.thunderbird/default/<random crap>/user.js (create this file if it doesn't exist)
Code:
user_pref("network.protocol-handler.app.http", "/usr/bin/firefox");


[edit] made a little more clearer


Thanks, that simple little trick just worked(tm). :D

Why this isn't available at least as an option is truly and utterly beyond me, since this is the least that people expect from any browser + mail app constellation, preview technology or not. :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum