This tip explains how to setup SSMTP on linux/ubuntu for sending mails from commandline. Below is short description on it.
|
Using SSMTP we could send mails from linux commandline
1.) Install SSMTP package
2.) Set up ssmtp configuration (mail id,port and credentials)
nano /etc/ssmtp/ssmtp.conf Edit the following lines with your credentials mailhub=smtp.gmail.com:587 3.) Now test the mail by following commands 4.) Press Ctrl+d after done it will send the mail 5.) Another alternate way is 6.) If you want to sent an attachment in mail then install mpack (other packages like mutt also available)
sudo apt-get install mpack
Then run the below command
mpack -s subject attachment.txt user@gmail.com. |