mailit function
mailit function
Here is a generic mail function I use with cron jobs or scripts that need to email information.
TIP: the context-type can be switched to sent html instead of plain text as well ;)
mailit ()
{
cat <<EOF | /usr/sbin/sendmail -f noreply -t
to:${sendto}
from:${from}
reply-to:${replyto}
subject: ${subject}
content-type: text/plain
${emailthis}
EOF
}
To use, set the variables first, then call the function ;) IE:
sento="someone@someemail.com"
from="sentfrom@someemail.com"
replyto="sentfrom@someemail.com"
subject="This is the email subject"
emailthis=`cat <<EOF
This is is the text
that is sent
in the body of the email.
Thanks,
Crouse
EOF`
mailit
