#!/bin/sh

# ymail - a script which allows GNOME applications to send email through Yahoo! Mail.
# Copyright (c) 2005 David L Norris <dave@webaugur.com>

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

# Grab all command line parameters and strip mailto: if it exists.
TOMAIL=`echo "${*}" | sed -e 's/mailto://g'`

# This is the URL Yahoo! Companion and Yahoo! Toolbar uses to send email:
TOURL="http://us.f300.mail.yahoo.com/ym/Compose?login=1&intl=us&.intl=&To="

# Ask GNOME for the web browser command.
BROWSER=`gconftool-2 --get '/desktop/gnome/url-handlers/http/command' | cut -f1 -d' ' `

# Print out what we are about to do
echo ${BROWSER} "${TOURL}${TOMAIL}"

# Execute mail command
${BROWSER} "${TOURL}${TOMAIL}"


