What package to install for sending emails from localhost Ubuntu?
I believe mailx is what you're looking for.
sudo apt-get install bsd-mailx
This will also install postfix at a minimum, and will give you a few options to set postfix up. If you have an SMTP server on your LAN, choose 'satellite system', then enter the mail domain name, and lastly the IP address of your SMTP server.
To use:
echo $MESSAGE_BODY | /bin/mail -s "$SUBJECT" "$RECIPIENT_ADDRESS"
You can also use a file for the body:
/bin/mail -s "$SUBJECT" "$RECIPIENT_ADDRESS" < /tmp/message.txt
The ssmtp
package is popular for an easily way to send email from an ubuntu box. Here is a tutorial to set it up to use gmail.