How to get ssmtp working with Zoneminder

From ZoneMinder Wiki
Revision as of 07:44, 22 March 2015 by Asker (talk | contribs)
Jump to navigationJump to search

Why do you need this

If you want Zoneminder to send you emails about alarms, you need to configure a way for ZM to send emails. SSMTP is one of several ways, and a lightweight and efficient one.


Background

SSMTP is a really light mail transfer agent (MTA) that a lot of people use in Linux. It is much more lightweight that sendmail for sure and I am told postfix too. Note that SSMTP does not really run a daemon process in your box, so trying "telnet localhost 25" is going to fail (and also why a traditional Zoneminder configuration of using local host fails) Instead what is does is this:

  • It installs a program called ssmtp that you can use to send emails
  • Creates a soft link to point sendmail to ssmtp, so you can use the sendmail command too

If you are running ZM on a "not to high end" machine and are monitoring more than 3-4 HD cameras, you will want to be prudent on what you want to install. SSMTP is a great choice.


Installation of SSMTP

Installation is very simple

sudo apt-get update
apt-get install ssmtp
apt-get install mailutils

You may not need mailutils, but that installs the "mail" utility that I find quite handy to send emails from the command line.


Configuration of SSMTP

Let's assume you want to hook it up to send emails using GMAIL as your outbound SMTP

ssmtp.conf

The SSMTP configuration file lie in /etc/ssmtp/ssmtp.conf. Here is a file that works for gmail. You will need to edit it to fit your gmail configuration

# # Config file for sSMTP sendmail # # The person who gets all mail for userids < 1000 # Make this empty to disable rewriting. root=postmaster # The place where the mail goes. The actual machine name is required no # MX records are consulted. Commonly mailhosts are named mail.domain.com mailhub=mail # Where will the mail seem to come from? #rewriteDomain= # The full hostname hostname=camerapc # ARC: Change this to your zone minder hostname # Are users allowed to set their own From: address? # YES - Allow the user to specify their own From: address # NO - Use the system generated From: address #FromLineOverride=YES root=email@gmail.com # ARC: Change this to your gmail id mailhub=smtp.gmail.com:587 rewriteDomain= hostname=email@gmail.com #ARC: I use my gmail id here too UseSTARTTLS=YES AuthUser=email #ARC: I use my gmail id without domain here AuthPass=xxxxxx #ARC: If you use 2 step authentication in gmail, you MUST generate an app specific password for gmail and add that here FromLineOverride=YES