Friday, October 02, 2009

Tidbit: Using Yahoo as your default email client

I just wrote a post on using GMail as your default email client and I thought there should be an easy way to do this for Yahoo Mail as well. And of course there is! Create a bash script with the following code and use it just as you would the gmailer script from the other post.



#!/bin/bash

getopen () {

if [ -x /usr/bin/xdg-open ]
then
export opener="/usr/bin/xdg-open"
elif [ -x /usr/bin/kde-open ]
then
export opener="/usr/bin/kde-open"
elif [ -x /usr/bin/gnome-open ]
then
export opener="/usr/bin/gnome-open"
else
echo "Requires xdg-open, kde-open or gnome-open"
exit 1
fi
}

getemail () {

export address=`echo $1 | sed 's/mailto://'`
export targeturl="http://compose.mail.yahoo.com/?To=$address"
}

getopen
getemail $1
exec $opener $targeturl
exit 0

2 comments:

James Cain said...

I tried this and it worked like a charm for Google. Many thanks for posting!

Shane said...

You're most welcome!