SendEmail is a lightweight command line SMTP agent. It was designed to be easily integrated in bash scripts, Perl programs etc. The program is in fact a Perl script, and it is distributed under GPL license. This is how you can send emails from command line using SendEmail and a regular gmail or yahoo account.
Installing SendEmail is easy:
$ sudo apt-get install libio-socket-ssl-perl \ libnet-ssleay-perl sendemail
Sending an email using gmail.com is as follows:
$ sendemail -f email@example.com -t firstname.lastname@example.org \ -u "this is the subject of the message" \ -m "and this is the message" \ -s smtp.gmail.com -o tls=yes -xu username -xp password
username and password above are your gmail.com username and password. The message is encrypted using TLS. email@example.com is where you want the message to be sent.
Similarly for yahoo.com:
$ sendemail -f firstname.lastname@example.org -t email@example.com \ -u "this is the subject of the message" \ -m "and this is the message" \ -s smtp.mail.yahoo.com -xu username -xp password
SendEmail comes with a regular man page and very extensive documentation accessible using –help option.