MozillaZine

how to put mozilla linking to a email client?

Discussion of features in Mozilla Firefox
DonPete
 
Posts: 269
Joined: July 7th, 2003, 5:10 pm

Post Posted August 2nd, 2003, 12:18 am

YFan wrote:My problem is that I don't understand the usr/bin stuff. If they are just a random directory and supposed to be replaced with some other directory, please tell me which directory (or what's in it -- the TB exe file or what).

/usr/bin is one of the directories that binaries are stored in on Unix/Linux systems. It's just supposed to be the path to the Thunderbird executable.

Also, from the mozex site:
MS Windows note: The path must not contain any "long filename" component. Please use the "dos mode" filename convention. ("Progra~1" instead of "Program Files" etc.)

And Windows systems use backslashes "" instead of forward slashes "/" as delimiters in the path.

daihard
Folder@Home

User avatar
 
Posts: 16633
Joined: November 17th, 2002, 6:27 pm
Location: Lynnwood, WA

Post Posted August 2nd, 2003, 12:24 am

Actually, the correct syntax is supposed to be <code>thunderbird -compose mailto:%a?subject=%s</code>. In fact, if you type in "thunderbird -compose mailto:daihard@fake.com?subject=Test" in the console, a new compoer window starts up, with "daihard@fake.com" in the To list and "Test" in the subject line.

However, once I put the line in the mailer edit box in Mozex and click on a mailto link, thunderbird will not start up. :oops:

The same procedure for kmail works beautifully. I wonder what the problem is...
Kubuntu 8.04 (kernel 2.6.24-25-generic) / KDE 3.5.10
CentOS 4.8 (kernel 2.6.9-78.0.22.ELsmp) / KDE 3.5.10
Mac OS X 10.6.1 (Snow Leopard) / iPhone 3GS (32GB black)

daihard
Folder@Home

User avatar
 
Posts: 16633
Joined: November 17th, 2002, 6:27 pm
Location: Lynnwood, WA

Post Posted August 2nd, 2003, 12:28 am

DonPete wrote:And Windows systems use backslashes "" instead of forward slashes "/" as delimiters in the path.

Just a bit OT, but 2000/XP recognises forward slashes as identical to backslashes, so typing "c:/apps/convert/convert.exe" will actually run the program stored as "c:\apps\convert\convert.exe".
Kubuntu 8.04 (kernel 2.6.24-25-generic) / KDE 3.5.10
CentOS 4.8 (kernel 2.6.9-78.0.22.ELsmp) / KDE 3.5.10
Mac OS X 10.6.1 (Snow Leopard) / iPhone 3GS (32GB black)

DonPete
 
Posts: 269
Joined: July 7th, 2003, 5:10 pm

Post Posted August 2nd, 2003, 12:43 am

daihard wrote:However, once I put the line in the mailer edit box in Mozex and click on a mailto link, thunderbird will not start up. :oops:

The same procedure for kmail works beautifully. I wonder what the problem is...

I had this problem, too. What I did was edit the "thunderbird" script and set MOZILLA_FIVE_HOME to Thunderbird's directory. After that, it worked without any problems.

I used to have symlinks to the Mozilla, Firebird, and Thunderbird executables in my path, but now I just have copies of these scripts with MOZILLA_FIVE_HOME set (so that if I execute one of them from another, it won't inherit the wrong value for MOZILLA_FIVE_HOME). That way, I don't have to edit the script every time I compile a new build. [Edit: actually, I still have a symlink to the Firebird executable, since Firebird doesn't use MOZILLA_FIVE_HOME]

daihard wrote:2000/XP recognises forward slashes as identical to backslashes, so typing "c:/apps/convert/convert.exe" will actually run the program stored as "c:\apps\convert\convert.exe".

Interesting. That's nice to know; now I won't have to keep backspacing because I type / instead of \ when I use XP.

daihard
Folder@Home

User avatar
 
Posts: 16633
Joined: November 17th, 2002, 6:27 pm
Location: Lynnwood, WA

Post Posted August 2nd, 2003, 1:23 am

DonPete wrote:I had this problem, too. What I did was edit the "thunderbird" script and set MOZILLA_FIVE_HOME to Thunderbird's directory. After that, it worked without any problems.

What does MOZILLA_FIVE_HOME do? I have heard about the environment variable but never set it on my machine. Firebird and Thunderbird have always worked without it for me.

DonPete wrote:
daihard wrote:2000/XP recognises forward slashes as identical to backslashes, so typing "c:/apps/convert/convert.exe" will actually run the program stored as "c:\apps\convert\convert.exe".

Interesting. That's nice to know; now I won't have to keep backspacing because I type / instead of \ when I use XP.

Yeah, that's very convenient. We used to keep a lot of ifdef's in the scripts to build our cross-platform products just because of the difference between '/' and '\\'. It's not necessary anymore, and that has helped simplify our scripts quite a bit.
Kubuntu 8.04 (kernel 2.6.24-25-generic) / KDE 3.5.10
CentOS 4.8 (kernel 2.6.9-78.0.22.ELsmp) / KDE 3.5.10
Mac OS X 10.6.1 (Snow Leopard) / iPhone 3GS (32GB black)

DonPete
 
Posts: 269
Joined: July 7th, 2003, 5:10 pm

Post Posted August 2nd, 2003, 1:39 am

daihard wrote:What does MOZILLA_FIVE_HOME do? I have heard about the environment variable but never set it on my machine. Firebird and Thunderbird have always worked without it for me.

MOZILLA_FIVE_HOME is just a variable for the Mozilla/Thunderbird directory. If you look at the script, it begins with this:
Code: Select all
# honor MOZILLA_FIVE_HOME if it's there
if [ -n "$MOZILLA_FIVE_HOME" ] ; then
  dist_bin="$MOZILLA_FIVE_HOME"
and ends with this:
Code: Select all
exec "$dist_bin/run-mozilla.sh" $script_args "$dist_bin/$MOZILLA_BIN" "$@"

"run-mozilla.sh" executes $MOZILLA_BIN, which in this case is "thunderbird-bin".

daihard
Folder@Home

User avatar
 
Posts: 16633
Joined: November 17th, 2002, 6:27 pm
Location: Lynnwood, WA

Post Posted August 2nd, 2003, 1:47 am

Okay, so if MOZILLA_FIVE_HOME is set, then the script searches for the thunderbird executable within that directory; otherwise, it will use the current directory. That makes sense. I typically create a symlink to "thunderbird" in my $HOME/bin directory. I wonder if that operation. In that case, should I still set MOZILLA_FIVE_HOME to $HOME/bin?
Kubuntu 8.04 (kernel 2.6.24-25-generic) / KDE 3.5.10
CentOS 4.8 (kernel 2.6.9-78.0.22.ELsmp) / KDE 3.5.10
Mac OS X 10.6.1 (Snow Leopard) / iPhone 3GS (32GB black)

asterix
 
Posts: 7
Joined: August 1st, 2003, 8:51 am
Location: France

Post Posted August 2nd, 2003, 1:55 am

DonPete wrote:What I did was edit the "thunderbird" script and set MOZILLA_FIVE_HOME to Thunderbird's directory. After that, it worked without any problems.


YES ! It works ! thank's
but it works only if thunderbird is not already running
if it's running, the syntax is :
Code: Select all
thunderbird -remote "mailto(%a)"

but this one works only if thunderbird is already running. So i think a script is necessary if you want it to work in all case.

Asterix

DonPete
 
Posts: 269
Joined: July 7th, 2003, 5:10 pm

Post Posted August 2nd, 2003, 1:56 am

daihard wrote:I typically create a symlink to "thunderbird" in my $HOME/bin directory. I wonder if that operation. In that case, should I still set MOZILLA_FIVE_HOME to $HOME/bin?

No, you should set it to the directory where "run-mozilla.sh" and "thunderbird-bin" are located.

daihard
Folder@Home

User avatar
 
Posts: 16633
Joined: November 17th, 2002, 6:27 pm
Location: Lynnwood, WA

Post Posted August 2nd, 2003, 2:01 am

DonPete wrote:
daihard wrote:I typically create a symlink to "thunderbird" in my $HOME/bin directory. I wonder if that operation. In that case, should I still set MOZILLA_FIVE_HOME to $HOME/bin?

No, you should set it to the directory where "run-mozilla.sh" and "thunderbird-bin" are located.

Thanks. I will try that.
Kubuntu 8.04 (kernel 2.6.24-25-generic) / KDE 3.5.10
CentOS 4.8 (kernel 2.6.9-78.0.22.ELsmp) / KDE 3.5.10
Mac OS X 10.6.1 (Snow Leopard) / iPhone 3GS (32GB black)

DonPete
 
Posts: 269
Joined: July 7th, 2003, 5:10 pm

Post Posted August 2nd, 2003, 2:55 am

asterix wrote:if it's running, the syntax is :
Code: Select all
thunderbird -remote "mailto(%a)"

but this one works only if thunderbird is already running. So i think a script is necessary if you want it to work in all case.

Well, I got a script working, but it's not perfect. I have this in a script called run-thunderbird.sh:
Code: Select all
#!/bin/sh

export MOZILLA_FIVE_HOME=$HOME/bin/MozillaThunderbird

$HOME/bin/MozillaThunderbird/thunderbird -remote "mailto($1)" ||
exec $HOME/bin/MozillaThunderbird/thunderbird -P default -compose mailto:$1?subject=$2;
To execute it, I have Mozex run this:
Code: Select all
/home/donpete/bin/run-thunderbird.sh %a %s

The problem is, if Thunderbird isn't running, the remote command gets sent to Firebird. It works fine if Thunderbird is already running, but if not, it sends the mailto() command to Firebird and I get a "mailto is not a registered protocol" alert (although it will start Thunderbird).

Also, Thunderbird doesn't handle the openURL() remote command, so I have to send the arguments separately if I don't want to do any ugly string parsing (which I don't). This also means that I can't send Thunderbird the subject if it's already running.

asterix
 
Posts: 7
Joined: August 1st, 2003, 8:51 am
Location: France

Post Posted August 2nd, 2003, 11:21 am

DonPete wrote:This also means that I can't send Thunderbird the subject if it's already running.


Yes you can like that :
Code: Select all
thunderbird -remote "mailto(%a?subject=%s)"
works

Asterix

asterix
 
Posts: 7
Joined: August 1st, 2003, 8:51 am
Location: France

Post Posted August 2nd, 2003, 12:18 pm

this one works well in both cases :
Code: Select all
#!/bin/sh
                                                                               
export MOZILLA_FIVE_HOME=PATH_TO_thunderbird
                                                                               
if [ $(ps aux | grep thunderbird | wc -l) -gt 4 ]; then
# thunderbird est lance
        $MOZILLA_FIVE_HOME/thunderbird -remote "mailto($1?subject=$2)"
else
# thunderbird n'est pas lance
        $MOZILLA_FIVE_HOME/thunderbird -P default -compose mailto:$1?subject=$2;fi

DonPete
 
Posts: 269
Joined: July 7th, 2003, 5:10 pm

Post Posted August 2nd, 2003, 12:49 pm

asterix wrote:Yes you can like that :
Code: Select all
thunderbird -remote "mailto(%a?subject=%s)"
works

You're right, that does work. Nice.

David James

User avatar
 
Posts: 1321
Joined: November 4th, 2002, 10:19 pm
Location: Ottawa, Ontario, Canada

Post Posted August 2nd, 2003, 7:15 pm

daihard wrote:
David James wrote:Actually, that should be
Code: Select all
/usr/bin/kmail --subject %s %a

so that you can get the subject field passed if there is one. See the newly updated <a href="http://mozex.mozdev.org/screenshots.html">mozex screenshots</a> page. Hmmm, I wonder who supplied the second screenshot :?:

I wonder who!!! ;) Thanks for the info. I discovered "%a" by fiddling with different format chars, and I sure had no idea you could pass the subject variable onto kmail as well. Where did you learn all that? :-({|=


Elementary my dear daihard, elementary. From the command line (remember that? :) ), I typed
Code: Select all
kmail --help

and a multitude of helpful info flooded my console (or rather, konsole).
Pinball-Firefox maintainer.
http://david.jamesnet.ca/
Debian Sid, KDE 3.3

Return to Firefox Features


Who is online

Users browsing this forum: No registered users and 1 guest