summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorDavid Steele <dsteele@gmail.com>2012-04-24 00:18:02 -0400
committerJan Holesovsky <kendy@suse.cz>2012-04-30 15:50:05 +0200
commit77d4873ee653549eb8fb8761253f9feb1eea1c11 (patch)
treeefa2ba74ddb451d14f735f68dbfe5d9ca6a26ef8 /shell
parentf4eb738cf778a337e31a864fc4a6af36f0fa60a5 (diff)
fdo#32621: Fall back to using the GNOME mailto URI handler if no valid mail program found
Diffstat (limited to 'shell')
-rwxr-xr-xshell/source/unix/misc/senddoc.sh49
1 files changed, 47 insertions, 2 deletions
diff --git a/shell/source/unix/misc/senddoc.sh b/shell/source/unix/misc/senddoc.sh
index 9d63ae3df63b..692930ec2eec 100755
--- a/shell/source/unix/misc/senddoc.sh
+++ b/shell/source/unix/misc/senddoc.sh
@@ -400,8 +400,53 @@ case `basename "$MAILER" | sed 's/-.*$//'` in
;;
*)
- echo "Unsupported mail client: `basename $MAILER | sed 's/-.*^//'`"
- exit 2
+ if [ -x /usr/bin/gnome-open ] ; then
+ MAILER = /usr/bin/gnome-open
+ elif [ -x /usr/bin/xdg-open ] ; then
+ MAILER = /usr/bin/xdg-open
+ else
+ echo "Unsupported mail client: `basename $MAILER | sed 's/-.*^//'`"
+ exit 2
+ fi
+
+ while [ "$1" != "" ]; do
+ case $1 in
+ --to)
+ if [ "${TO}" != "" ]; then
+ MAILTO="${MAILTO:-}${MAILTO:+&}to=$2"
+ else
+ TO="$2"
+ fi
+ shift
+ ;;
+ --cc)
+ MAILTO="${MAILTO:-}${MAILTO:+&}cc="`echo "$2" | ${URI_ENCODE}`
+ shift
+ ;;
+ --bcc)
+ MAILTO="${MAILTO:-}${MAILTO:+&}bcc="`echo "$2" | ${URI_ENCODE}`
+ shift
+ ;;
+ --subject)
+ MAILTO="${MAILTO:-}${MAILTO:+&}subject"=`echo "$2" | ${URI_ENCODE}`
+ shift
+ ;;
+ --body)
+ MAILTO="${MAILTO:-}${MAILTO:+&}body="`echo "$2" | ${URI_ENCODE}`
+ shift
+ ;;
+ --attach)
+ MAILTO="${MAILTO:-}${MAILTO:+&}attach="`echo "file://$2" | ${URI_ENCODE}`
+ shift
+ ;;
+ *)
+ ;;
+ esac
+ shift;
+ done
+
+ MAILTO="mailto:${TO}?${MAILTO}"
+ ${MAILER} "${MAILTO}" &
;;
esac