Saturday, September 11, 2010

Monit notifications using Google Gmail SMTP

I had to do a bunch of fiddling around to figure this out, hence a quick blog post.
The situation: I want monit to send me email notifications and I don't have (or want) an SMTP server running on the box. Furthermore, like many ISPs, my ISP won't allow outbound connections to port 25 anyway.
Solution: as a Gmail user, I can use Google's SMTP servers for sending mail.
You need monit version >= 4.10 for this to work. I got it working on Ubuntu Jaunty 9.04 and Lucid 10.04 just fine. Here is the set mailserver syntax to make it happen:
set mailserver smtp.gmail.com port 587
    username "someuser@gmail.com" password "password"
    using tlsv1
    with timeout 30 seconds
References:

3 comments: