DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Email In Bash

12.10.2007
| 7544 views |
  • submit to reddit
        //Bash email
#!/bin/bash

function email
{
echo "this is a test" | mail -s "test" "$1"
}

if [ "$1" = "" ]; then
echo "nothing in param"
else
echo "sending mail"

#emailing attachment
#uuencode statsNbaAllStarSim statssim | mail -s "test attachement" ai@XCXCXCXCXC.com
#uuencode <filename that will be send> <name for attached file that is sent> |

#passing the param to function
email $1
fi