After "Info( "Updating DB: $state->{Name}\n" );", and add these lines:
Code: Select all
my $newstate = uc $state->{Name};
open(SENDMAIL, "|/usr/sbin/sendmail -oi -t -f<FROM_ADDRESS> -odb") or die "Can't fork for sendmail: $!\n";
print SENDMAIL <<"EOF";
To: <EMAIL_ADDRESS>
Subject: ZoneMinder: $newstate
EOF
close(SENDMAIL);
1. there is no space between "-f" and the from address. If your from address is "installer@myzone.com", it should read "-finstaller@myzone.com"
2. <EMAIL_ADDRESS> has to be escaped. If your to: address is recipient@myzone.com, it should look like "To: recipient\@myzone.com".
Hope that helps...kind of a nice touch. Now I can pull my USB stick on the way out and get a confirmation that the system actually armed. Not that it has ever failed so far, but still nice to know.
This only works when the runstate changes, not when the system is started or stopped (those are other code blocks within zmpkg.pl). You can modify the code and placement if that information is important to you, etc.