I too had this issue and through many many google searches I was able to find my solution and I wanted to include my major mistakes and how I ultimately resolve the issue.
Can't send email: error closing /usr/lib/sendmail: (exit 256)
Tip 1: check your config based on this guide
https://wiki.zoneminder.com/index.php/H ... Zoneminder?
Tip 2: DOUBLE CHECK the ssmtp.conf entries and the revaliases. (one of my issues was I had a stupid "." instead of a ":" for the www-data entry.)
Tip 3: Try to isolate the issue outside of ZoneMinder I found a helpful suggestion on a different post
"Have you tested your config with below commands (from unix.stackexchange forum)?
First you need to create a mail.txt file with some text.
$ nano mail.txt
$ sudo -u root ssmtp -v
my.own.email@gmail.com < mail.txt
$ sudo -u www-data ssmtp -v
my.own.email@gmail.com < mail.txt
$ /usr/sbin/ssmtp -v
my.own.email@gmail.com < mail.txt
If one of these fails, then you still have problems with permissions/owners... Check also the "mail" group, as you might want to add www-data to this group. " from user bobylapointe69300
viewtopic.php?t=25346
Tip 4: Check your perl installations for MMIME::Lite and MNet::SMTP I glossed over this
Making sure you have MIME::Lite and Net::SMTP
So after getting various errors, I discovered Ubuntu Server did not install MIME::Lite with its default install.
It's good idea to install them if you don't have it. To check if you have them:
perl -MMIME::Lite -e "print \"Module installed.\\n\";"
perl -MNet::SMTP -e "print \"Module installed.\\n\";"
And to install:
sudo perl -MCPAN -e shell
install MIME::Lite
install Net::SMTP
Tip 5: check the permissions of the ssmtp files "ssmtp.conf" "revaliases" to ensure www-data has read access to them.
Tip 6 tail -f /var/log/syslog is your friend. Use it and watch the output when you think your filter is firing off. I noticed at some point during my troubleshooting that my event was firing but it wasnt producing any results to email me about. Its a good way to see whats going on when your filters run and whats going wrong.
I know some of this is redundant but I wanted to consolidate all of it in one place.
Thanks to everyone for their support best of luck.