Question : Need minimum send an email from shell script command

Ive setup a MYSQL server that has nothing on it but MYSQL. I need to create a bash script that sends out a simple notification email when certain events happen.

My question is:
On a slim version of Ubuntu LTS, what can i do to install a small bin file or small service that does nothing more than send out a real simple email by typing the generic/common "mail" command ?? I dont need the server to receive mail, only send mail as its only going to send a small number of emails to my address.

Answer : Need minimum send an email from shell script command

Hi,

You can install mailx using the command:

sudo apt-get install mailx

then you can call it in a script:

echo " Here's the Mail Body" | mailx -s "Subject" "[email protected]"  -a "From:youcom>"

Replace "Here's the Mail Body", "Subject", " "[email protected]" and apparent sender "From:youcom>"  as you wish.

If you don't want to use a local mailer you can use ssmtp package instead:
sudo apt-get install ssmtp

will help yu get and install the package. For configuration see the /etc/ssmtp.conf

Cheers,
K.
Random Solutions  
 
programming4us programming4us