You can use mail option from Linux command line. Default format is given below.
mail -s "Hello ASKUBUNTU" you@youremailid.com
To add content to the body of the mail while running the command you can use the following options. If you want to add text on your own:
echo "This will go into the body of the mail." | mail -s "Hello world" you@youremailid.com
And if you want mail to read the content from a file:
mail -s "Hello world" you@youremailid.com < /home/calvin/application.log
Some other useful options in the mail command are:
-s
subject (The subject of the mail)
-c
email-address (Mark a copy to this “email-address”, or CC)
-b
email-address (Mark a blind carbon copy to this “email-address”, or BCC)
Here’s how you might use these options:
echo "Welcome to the world of Calvin n Hobbes" | mail -s "Hello world" calvin@cnh.com -c hobbes@cnh.com -b susie.derkins@cnh.com
To add attachments u can use the -a
option in mail
mail -a /path/to/file.to.attach -s "Hello ASKUBUNTU" you@youremailid.com
Hope this helps.
I'm by no means an expert on this topic, however your configuration appears to be missing:
TLSCert
The file name of an RSA certificate to use for TLS, if required.
TLSKey
The file name of an RSA key to use for TLS, if required.
TLS_CA_File
A file of trusted certificates for validating the server, if required.
TLS_CA_Dir
A directory of trusted certificates for validating the server, if required.
I would assume these are required if using TLS
Source: http://linux.die.net/man/5/ssmtp.conf
Best Answer
Ok I figured it out... I had to use
UseSTARTTLS=YES
instead ofUseTLS=YES
. Also I had to enterroot:me@server.com:mail.server.com:25
in /etc/ssmtp/revaliases. Hope this helps others as well.If you want to use other user accounts than root, you will have to add those to /etc/ssmtp/revaliases as well and add them to the 'mail' group.