Created
February 11, 2011 18:26
-
-
Save Jonty/822787 to your computer and use it in GitHub Desktop.
Temporarily uploads email attachments from mutt to a web-accessible remote directory for viewing.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image/*; ~/.showinbrowser.sh %s | |
application/*; ~/.showinbrowser.sh %s | |
audio/*; ~/.showinbrowser.sh %s | |
text/*; ~/.showinbrowser.sh %s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this line: | |
set mailcap_path="~/.mutt-mailcap" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Customise these, obviously | |
REMOTEHOST='jonty.co.uk' | |
REMOTEPATH='/home/jonty/bits/attachments/' | |
HTTPPATH='http://jonty.co.uk/bits/attachments/' | |
FILENAME=`echo $1 | grep -E -o '[^\/]+$'` | |
clear | |
echo "Copying file to $REMOTEHOST..." | |
scp $1 "$REMOTEHOST:$REMOTEPATH$FILENAME" | |
clear | |
echo "Changing remote permissions..." | |
ssh $REMOTEHOST -C "chmod 777 '$REMOTEPATH$FILENAME'" | |
clear | |
echo "\nOpen $HTTPPATH$FILENAME to view the attachment.\n" | |
echo "Press enter to continue" | |
read wait | |
clear | |
echo "Removing remote file..." | |
ssh $REMOTEHOST -C "rm '$REMOTEPATH$FILENAME'" | |
clear |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment