Mailinglist Archive: opensuse (3666 mails)

< Previous Next >
Firefox and KMail Script
  • From: Louis Richards <louis@xxxxxxxxxxxxxxxxxx>
  • Date: Sat, 26 Mar 2005 15:47:44 -0500
  • Message-id: <200503261547.44172.louis@xxxxxxxxxxxxxxxxxx>
I have been using KMail and Firefox. Firefox is set as the default browser in
KDE. KMail *was* set up as the default email client using
gnome-control-center.

Mailto links would start the KMail composer without the recipient or subject
information. The send link option in Firefox would again start the composer
without the information.

I changed the email client in gnome-control-center to point to the following
script. This seems to work but also seems like more than should be needed. Is
there a simpler way to get these two programs to play nice with each other?
I'm using 9.1 with KDE 3.4.

Some lines may have wrapped.

#!/bin/bash
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//)

#Get Subject, BCC, CC and Body
SUBJECT=$(echo "$MAIL_DATA" | \
/bin/sed -s 's/.*[&?]subject=//I' | /bin/sed -s 's/[&?].*//' | \
/bin/sed -s 's/%3A/:/g' | \
/bin/sed -s 's/%20/ /g')
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/[&?].*//')
BODY=$(echo "$MAIL_DATA" | /bin/sed -s 's/.*[&?]body=//I' | \
/bin/sed -s 's/[&?].*//' | \
/bin/sed -s 's/%20/ /g' | \
/bin/sed -s 's/%26/\&/g' | \
/bin/sed -s 's/%2B/+/g' | \
/bin/sed -s 's/%2F/\//g' | \
/bin/sed -s 's/%3A/:/g' | \
/bin/sed -s 's/%3D/=/g' | \
/bin/sed -s 's/%3F/?/g')

/opt/kde3/bin/kmail "$RECIPIENT" -s "$SUBJECT" -b "$BCC" -c "$CC" --body
"$BODY"

--
Louis Richards
Who gets the feeling he took the long way around on this one. ;-)

< Previous Next >
This Thread
  • No further messages