Created
March 3, 2014 06:35
-
-
Save maimai-swap/9319546 to your computer and use it in GitHub Desktop.
mutt mail send with a attached file of text.
This file contains hidden or 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 | |
dir=/home/ec2-user/tmp | |
filepath=$dir/testfile.csv | |
Err(){ echo "$1">&2; exit 1; } | |
mail_to='[email protected]' | |
mime=`file --mime $filepath | cut -d' ' -f2` | |
filename=`basename $filepath` | |
echo "mime-type=$mime" | |
echo "filename=$filename" | |
echo "filepath=$filepath" | |
# check file | |
if [ -e $filepath ]; then | |
cd $dir | |
echo "mail body with attached file..." | mutt -s "test mail title" -a "$filepath" -- $mail_to | |
else | |
Err "Warning : Cannot open ${filepath}" | |
exit 1 | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment