Skip to content

Instantly share code, notes, and snippets.

@sunix
Last active August 29, 2015 14:05
Show Gist options
  • Save sunix/7db811b40dd8bfb289ae to your computer and use it in GitHub Desktop.
Save sunix/7db811b40dd8bfb289ae to your computer and use it in GitHub Desktop.
In Nautilus, will open a new email in Thunderbird with selected files as attachments. This script needs to be copied to ~/.gnome2/nautilus-scripts folder. Select the files to be attached, right click, select Scripts>sentto. Using nautilus scripts http://g-scripts.sourceforge.net/.
#!/bin/bash
# Copyright 2014, Sun Seng David TAN <sunix@sunix.org>
# 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 3 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 General Public License at <http://www.gnu.org/licenses/> for
# more details.
# In Nautilus, will open a new email in Thunderbird with selected files
# as attachments.
# This script needs to be copied to ~/.gnome2/nautilus-scripts folder.
# Make it executable (chmod +x ~/.gnome2/nautilus-scripts/sendto)
# Select the files to be attached, right click, select Scripts>sentto
IFS=$'\n'
for file in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS; do
if [ "$FILES" == "" ]; then
FILES="file://$file"
else
FILES="$FILES,file://$file"
fi
done
thunderbird -compose "attachment='$FILES'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment