First, install the "mail-client/mailx" package by using emerge, as root:
echo "Hello World!" | mail -s Subject email@example.com
This assumes you already have "postfix" installed and configured, which you can check how to do here:
emerge postfix /etc/init.d/postfix start
The test e-mail should arrive to your destination e-mail box of choice. Script away using the command to send e-mails in batch or to warn the sysadmin of problems in the box.