#!/bin/sh # # firefox will call this like eg. # mailto.sh mailto:jae@zhar.net?subject=Mozilla%20external%20mailer # # Tips for setting this up found at: # http://howto-pages.org/mozilla.php # Copied much of this script from: # http://rignesnet.tzo.com/articles/mailto_helper.html # # This needs to be executable. In you path. Then you set the preference # network.protocol-hanlder.app.mailto to the name of this file (as a string) in # firefox's about:config. #echo $@ (echo "$1" | grep -q mailto) || exit 1 [ $# -lt 1 ] && exit 1 MAILTO_URL="$@" #Strip off the protocol MAIL_DATA=$(echo "$MAILTO_URL" | /bin/sed -s 's/^mailto://I') #Get Recipient and strip it off RECIPIENT=$(echo "$MAIL_DATA" | cut -d? -f1 -) MAIL_DATA=$(echo "$MAIL_DATA" | /bin/sed -s "s/^$RECIPIENT//") MAIL_DATA=$(echo "$MAIL_DATA" | /bin/sed -s "s/%20/ /g") #Get Subject,BCC, and CC SUBJECT=$(echo "$MAIL_DATA" | \ /bin/sed -s 's/.*?subject=//I' | /bin/sed -s 's/?.*//') BCC=$(echo "$MAIL_DATA" | /bin/sed -s 's/.*?bcc=//I' | \ /bin/sed -s 's/?.*//') CC=$(echo "$MAIL_DATA" | /bin/sed -s 's/.*?cc=//I' | \ /bin/sed -s 's/?.*//') #Call mutt in an xterm x-terminal-emulator -fg white -bg black -geometry 80x30 -e \ noflow mutt "$RECIPIENT" -b "$BCC" -c "$CC" -s "$SUBJECT"