Return to Snippet

Revision: 31304
at September 2, 2010 16:14 by rkumar


Initial Code
#!/bin/bash
## vim:ts=4:sw=4:tw=100:ai:nowrap:formatoptions=croqln:
file=${1}
echo -n "Enter body:"
read body
echo -n "Enter Subject: "
read subject
[[ -z "$body" ]] && { body="Sending attachment using mail"; }
[[ -z "$subject" ]] && { subject="backup: $file "; }
[[ -z "$file" ]] && { echo "Error: file blank." 1>&2; exit 1; }
{ echo -e "$body"; uuencode "$file" "$file"; } | mail -s "$subject" ${GMAIL_USER}@gmail.com ;

Initial URL

                                

Initial Description

                                

Initial Title
mail a file as attachment

Initial Tags
Bash, script

Initial Language
Bash