0% found this document useful (0 votes)
78 views17 pages

MSMTP

The software MSMTP is a latest SMTP client runs on a wide variety of platforms. It seems msmtp is overtaking ssmtp which is a software of similar nature. At present the Zoneminder has been programmed to use ssmtp as an email software under NEW_MAIL_MODULES. To send email alerts in zmfilter.pl , a programme has been written to use MIME::Lite module which uses “sendmail” command. The worked example in this blog post shows how to use MSMTP insted of SSMPT in Zoneminder to send email alert

Uploaded by

Bandula
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views17 pages

MSMTP

The software MSMTP is a latest SMTP client runs on a wide variety of platforms. It seems msmtp is overtaking ssmtp which is a software of similar nature. At present the Zoneminder has been programmed to use ssmtp as an email software under NEW_MAIL_MODULES. To send email alerts in zmfilter.pl , a programme has been written to use MIME::Lite module which uses “sendmail” command. The worked example in this blog post shows how to use MSMTP insted of SSMPT in Zoneminder to send email alert

Uploaded by

Bandula
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

How to use MSMTP as email

software in Zoneminder (v1.33.14.)


on Ubuntu 19.04
 B.K.Jayasundera

The  software MSMTP is a latest  SMTP client runs on a wide


variety of platforms. It seems msmtp is overtaking ssmtp which
is a software of similar nature.

At present the Zoneminder has been  programmed  to use


ssmtp as an email software under NEW_MAIL_MODULES.

To send email alerts in zmfilter.pl , a programme has been


written to use MIME::Lite module  which uses “sendmail”
command.

The worked example in this blog post shows how to use


MSMTP  insted of SSMPT  in Zoneminder to send email alerts of
motion detection events.

First you will have to install MSMTP  ( If  ssmtp , sendmail 


available , please uninstall completely )

Open the Ubuntu terminal and run

sudo apt install msmtp


After installing , you can find the main executable file msmtp at
/usr/bin

Figure:- 1 msmtp file created at /usr/bin/

Then create   sendmail file which a symlink of  msmtp


( at /usr/bin)  in /usr/sbin/ .

Run on the Ubuntu terminal

sudo ln -s /usr/bin/msmtp /usr/sbin/sendmail


Note: before making above symlink , make sure that there is no
sendmail file in /usr/bin

When zmfilter.pl searchs  for /usr/sbin/sendmail , it redirect to


msmtp which is the main executable file at /usr/bin/.

Figure:-2 sendmail file at /usr/sbin

Now you will have to create a configuration file called


msmtprc which contains email
hosts ,ports ,certificates ,email details etc at the
directory /etc/
Creating a ~/.msmtprc file in home directory is not essential as
we are making a file at /etc/ . Then msmtp   by default ,
connects with    msmtprc at /etc/

On the Ubuntu terminal

sudo gedit /etc/msmtprc

Figure:- 3 msmtprc at /etc/

When the empty file is opened, enter the following scripts


# Set default values for all following accounts.
defaults
auth on
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile ~/.msmtp.log

# Gmail
account gmail
host smtp.gmail.com
port 587
from your gmail address
user your gmail address
password your gmail password

# Set a default account


account default : gmail

Figure:-4 Scrips in /etc/msmtprc


To add group www-data to the file

Then on the Ubuntu terminal

sudo chown root:www-data /etc/msmtprc

Now you can try a test mail on the terminal

echo "Subject: sendmail test" | sendmail -v


bkjaya1952@aol.com

Note : replace bkjaya1952@aol.com with your receiving email

How to make changes in Zoneminder for MSMTP

It is assumed that the Zoneminder software is already installed


in your Ubuntu PC

Please refer the following link for installation guide for


Zoneminder

HOW TO INSTALL ZONEMINDER, v1.33.0. ON UBUNTU 18.10


/19.04
Figure:- 5 ZM-console

Go to Options/Email on the ZM-Console

And  tick boxes and make changes in the cages as sown in


following two figures

 
Figure:- 6 Upper part of the page at Options/Email
Please note the following additional entries under
EMAIL_BODY cage

Attach (first) event image with the highest score : %EIM%

Attach event mpeg video : %EV%

 
Figure:-7 Lower part of the page at Options/Email

Making a filter to initiate email process

Make a filter as shown in the figure below and execute


Figure:-8 filter to select events of maximum score is > or= to 5
and send email alerts

Figure:- 9 Zm-System Log showing email sending process

Following 2 figures show the received emails


Figure:- 10 received email alerts
 

Figure:- 11 received email alerts

NOTE:- Please refer the following link to find the latest


developments :

How to resolve e- mailing problem in Zoneminder when


using msmtp with gmail

You might also like