Email is logical choice, but nothing was installed already that would allow me to send email from the command line, and hence, from a script. I just want to use my ISP instead of creating some sort of complicated configuration. In other words, it doesn't make sense to me to host an SMTP server.
This is a really simple idea, except that, in typical Linux fashion, there are 14 different ways to set up email, approximately :).
After doing some searching and reading, here's what I came up with: msmtp and mailx
Install msmtp and mailx:
sudo apt-get install msmtp mailx
Setup your msmtprc file:
cat >~/.msmtprc <<END account rr host smtp-server.my-isp.com from waters@my-isp.com user waters password my-password account default : rr END
chmod 600 ~/.msmtprc
Send an email!
echo "test message" | mailx -s "test" my_yahoo_email@yahoo.com
I have to give some credit to the following blog. It's basically the same thing, but he's adding in gmail as the SMTP server. The msmtp man page also has some information on this.
http://www.klenwell.com/press/2009/03/ubuntu-email-with-mailx/
No comments:
Post a Comment