[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to set up iceweasel 3.5 to use mutt as mailer for "link sendto"



Elimar Riesebieter <riesebie@lxtec.de>:
>  I've tried settings -> apps -> mailto -> shellscript
> 
>  Shellscript:
> 
>  #!/bin/sh
>  exec xterm -e mutt "$@"
> 
>  The xterm only pops up for 1 second.
> 
>  Any hints?

Ben at linuxgazette.net and I've been playing with this for years (I
haven't used it in a while; caveat emptor):

   ----------------------------
#!/usr/bin/perl
#
# pinehelper.pl - Original from Ben Okopnik of LinuxGazette.net
#
#   i) install wherever you want, make it world execute.
# 
#  ii) edit the user's prefs.js (via "about:config") in 
#      ~/.mozilla/firefox/$blah.default:
#
#         user_pref("network.protocol-handler.app.mailto", \
#             "/path/to/pinehelper");
#
# iii) edit "$fn" and "geometry" to taste.
#
# Restart FF, and clicking on a "mailto:"; link should fire up
# an xterm running mutt.  To: will already be filled in.  If
# the link provided a "Subject:", it should be handled as well.
#
# 13Nov2005   Ben Okopnik   0001   Fix Firefox mailto: handling
# 16Jun2007   sbk           0002   bulletproofing, strict, my().
#

use diagnostics;
use warnings;
use strict;

my ( $fn, @chunks, $key, $value, %header, $opts);

# xterm font
#
# $fn = q(-*-*-medium-r-normal-*-12-*-*-*-c-*-iso8859-15);
$fn = q(-*-*-medium-r-normal-*-15-*-*-*-c-*-iso8859-15);
$geom = q(105x57-84+64);

@chunks = split /[?&]/, shift;

for ( @chunks ) {

   ( $key, $value ) = split /[:=]/;

   # Cheap-ass entity conversion; populates %header hash as:
   #
   #   key      value
   #   ---      -----
   #   subject  "subject string"
   #   mailto   "who@where.com"
   #
   ( $header{ $key } = $value ) =~ s/%(..)/pack("H2",$1)/eg;
}

# Define Mutt switches for any headers we're interested in, including
# optional ones
# 
$opts = qq[ -s "$header{subject}" ] if exists $header{subject};
$opts .= $header{mailto};

exec qq(/usr/bin/xterm -fn $fn -geometry $geom -T Mutt -e /usr/bin/mutt $opts) ||
	die qq(Blue?  No, red?!  Aiiii!: $!);

__END__

   ----------------------------



-- 
Any technology distinguishable from magic is insufficiently advanced.
(*)    http://blinkynet.net/comp/uip5.html      Linux Counter #80292
- -    http://www.faqs.org/rfcs/rfc1855.html    Please, don't Cc: me.


Reply to: