{"id":241,"date":"2019-01-26T16:58:39","date_gmt":"2019-01-26T22:58:39","guid":{"rendered":"http:\/\/home.iseeancestors.com\/blog\/?p=241"},"modified":"2020-06-08T14:47:03","modified_gmt":"2020-06-08T20:47:03","slug":"how-to-lorex-nvr-e-mail-notifications","status":"publish","type":"post","link":"https:\/\/home.iseeancestors.com\/blog\/2019\/01\/26\/how-to-lorex-nvr-e-mail-notifications\/","title":{"rendered":"How-To:  Lorex NVR E-Mail Notifications"},"content":{"rendered":"\n<div class=\"wp-block-image\"><figure class=\"alignleft\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"209\" src=\"http:\/\/home.iseeancestors.com\/blog\/wp-content\/uploads\/system-3-300x209.jpg\" alt=\"Lorex 4KHDIP86\" class=\"wp-image-234\" srcset=\"https:\/\/home.iseeancestors.com\/blog\/wp-content\/uploads\/system-3-300x209.jpg 300w, https:\/\/home.iseeancestors.com\/blog\/wp-content\/uploads\/system-3.jpg 751w\" sizes=\"auto, (max-width: 300px) 85vw, 300px\" \/><\/figure><\/div>\n\n\n\n<p>This is my review of the e-mail alert notifications on a Lorex 4K IP Camera System. <span id='easy-footnote-1-241' class='easy-footnote-margin-adjust'><\/span><span class='easy-footnote'><a href='https:\/\/home.iseeancestors.com\/blog\/2019\/01\/26\/how-to-lorex-nvr-e-mail-notifications\/#easy-footnote-bottom-1-241' title='Specifically I have model 4KHDIP86, which is described as \u201c4K Ultra HD IP 8 Channel NVR System with 6 Outdoor 4K 8MP IP Cameras, 130FT Night Vision, 2TB Hard Drive.\u201d  The Network Video Recorder (NVR) is model NR908X, or specifically NR9082 with the 8-channel configuration.'><sup>1<\/sup><\/a><\/span><\/p>\n\n\n\n<p>You\ncan configure the Lorex NVR to send an e-mail alert when a\nsurveillance camera detects motion in its field of view.  It can\noptionally include a snapshot, which hopefully shows what caused the\nevent.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>Carefully consider whether you want e-mail alerts in the first place.  I recommend enabling this feature only for cameras where you don\u2019t expect a motion event.  But if you do get one, you want to know immediately.  For example, when you monitor your fenced backyard, where only an intruder should cause a motion event.<\/p>\n\n\n\n<p>I also recommend disabling e-mail alerts late at night by using the scheduling feature.  An immediate e-mail alert does no good while you\u2019re sleeping.  If you want to monitor snapshots from past motion events, consider using the NVR\u2019s FTP feature instead.  See my <a href=\"http:\/\/home.iseeancestors.com\/blog\/2019\/01\/24\/how-to-lorex-nvr-file-transfer-protocol\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"prior post (opens in a new tab)\">prior post<\/a>.<\/p>\n\n\n\n<p>The\nFTP facility might be a better way to review motion events without\nfilling up your e-mail inbox.  Depending on your settings, a snapshot\nis relatively large, being \u00bd to 1 or 2 Megabytes in size.  If you\nget several e-mails, they require a lot of bandwidth on your cellular\nservice and also storage space on your e-mail server.  Plus, you\ncannot easily suspend these alerts if for example, you plan to mow\nyour lawn.<\/p>\n\n\n\n<p>The\ne-mail sent from the Lorex NVR uses the Pacific timezone rather than\nthe local timezone already configured.  On some e-mail clients, this\ncauses alerts to appear as if they were sent in the early morning\nhours.  In other words they won\u2019t appear in your inbox in order by\nlocal time.  It\u2019s frustrating because the alert doesn\u2019t appear as\nthe most recent message I receive.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Automation to the Rescue<\/h4>\n\n\n\n<p>I\nmanage my own website, so I automated the alert e-mails to reduce\ntheir size and send them under my local time zone.  I can also easily\nsuspend them.  If you have your own website, two simple scripts will\ndo the trick.  Here\u2019s how I did it.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Create an E-Mail Account<\/h4>\n\n\n\n<p>On\nyour web hosting server, create a new e-mail account for your\nwebsite.  You could name it something like \u201calert@yoursite.com.\u201d \nSpecify a strong password and note the Simple Mail Transfer Protocol\n(SMTP) parameters required by your hosting provider to send and\nreceive e-mails with this account.  You will specify this e-mail\naddress and those parameters below.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"http:\/\/home.iseeancestors.com\/blog\/wp-content\/uploads\/email-account.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"240\" src=\"http:\/\/home.iseeancestors.com\/blog\/wp-content\/uploads\/email-account-300x240.jpg\" alt=\"E-Mail Account\" class=\"wp-image-249\" srcset=\"https:\/\/home.iseeancestors.com\/blog\/wp-content\/uploads\/email-account-300x240.jpg 300w, https:\/\/home.iseeancestors.com\/blog\/wp-content\/uploads\/email-account-768x614.jpg 768w, https:\/\/home.iseeancestors.com\/blog\/wp-content\/uploads\/email-account.jpg 900w\" sizes=\"auto, (max-width: 300px) 85vw, 300px\" \/><\/a><\/figure><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">Create an E-Mail Filter<\/h4>\n\n\n\n<p>Your\nweb hosting provider should allow you to create an e-mail filter,\nsuch that whenever an e-mail is received on this new account, it is\nnot placed in the inbox.  Instead it is \u201cpiped\u201d to a script,\nwhich handles it programatically.  I describe such a script below.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><a href=\"http:\/\/home.iseeancestors.com\/blog\/wp-content\/uploads\/email-filter.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"192\" src=\"http:\/\/home.iseeancestors.com\/blog\/wp-content\/uploads\/email-filter-300x192.jpg\" alt=\"E-Mail Filter\" class=\"wp-image-250\" srcset=\"https:\/\/home.iseeancestors.com\/blog\/wp-content\/uploads\/email-filter-300x192.jpg 300w, https:\/\/home.iseeancestors.com\/blog\/wp-content\/uploads\/email-filter-768x492.jpg 768w, https:\/\/home.iseeancestors.com\/blog\/wp-content\/uploads\/email-filter.jpg 900w\" sizes=\"auto, (max-width: 300px) 85vw, 300px\" \/><\/a><\/figure><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">Enable Motion Events and Snapshots<\/h4>\n\n\n\n<p>I will not repeat the steps to configure e-mail alerts with snapshot attachments here.  Please refer to Lorex NVR manual.  Or, refer to my <a href=\"http:\/\/home.iseeancestors.com\/blog\/2019\/01\/24\/how-to-lorex-nvr-file-transfer-protocol\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"prior post (opens in a new tab)\">prior post<\/a> on using FTP.  Just be sure to check the box for \u201cSend Email\u201d under Event, Motion, Motion Detect in addition to all the other steps to enable snapshots.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Enable E-Mail Notifications<\/h4>\n\n\n\n<p>On\nthe NVR, navigate to Network, EMail.  Here I show the NVR web\ninterface, but you can use the Flir Cloud Client, or the NVR itself\nwith a monitor or TV.  Click the Enable check box to enable e-mail\nprocessing.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"900\" height=\"673\" src=\"http:\/\/home.iseeancestors.com\/blog\/wp-content\/uploads\/email.jpg\" alt=\"Setup-EMail-EMail\" class=\"wp-image-251\" srcset=\"https:\/\/home.iseeancestors.com\/blog\/wp-content\/uploads\/email.jpg 900w, https:\/\/home.iseeancestors.com\/blog\/wp-content\/uploads\/email-300x224.jpg 300w, https:\/\/home.iseeancestors.com\/blog\/wp-content\/uploads\/email-768x574.jpg 768w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/figure>\n\n\n\n<p>Now\ndecide which e-mail server to use to send your e-mails.  Each time\nthe NVR issues an e-mail, it will log into this e-mail server in\norder to send it.  You can use the Lorex e-mail server.  Follow the\ninstructions to do that in the manual.  You can use your personal\ne-mail account, like Google GMail or Microsoft Outlook.  Follow the\ninstructions provided by those facilities.  Note you may need to\nenable less-secure log in capability on your personal e-mail account.\n Otherwise the server might not allow a log in from the Lorex NVR. \nYour third and final choice is the e-mail account you created above\nat your web server.<\/p>\n\n\n\n<p>The\nLorex account may be the best choice.  With it, you don\u2019t have to\nworry about the storage of sent e-mails.  If you use a personal\naccount like GMail, each time the NVR sends an e-mail, GMail will\nstore what was sent in your \u201csent\u201d folder.  Likewise for e-mail\nsent via your web server account.  Although you\u2019ll have a record of\nwhat was sent, you should periodically delete those e-mails to avoid\nusing excessive disk space.  Another consideration for the Lorex\nserver however, is Lorex will have access to your snapshots.  It is\nunknown what they may do with them.<\/p>\n\n\n\n<p>Fill\nin the fields for SMTP server, SMTP port, and Encrypt Type as\ndescribed by your e-mail server documentation.  Enter your username\nand password.  They are used by the NVR to log into your e-mail\nserver.  \u201cSender\u201d is the e-mail address from which the alert will\nappear to originate.  I use my personal e-mail address for that.<\/p>\n\n\n\n<p>The\n\u201cReceiver\u201d field is the e-mail address of the account you created\nat your web server to receive each e-mail alert sent by the NVR.  In\nthis example, that would be \u201calert@yoursite.com.\u201d  When the alert\nis received at your web server, it will be handled by the e-mail\nfilter you created above.<\/p>\n\n\n\n<p>When\nyou configure a motion event to send an e-mail, a snapshot is\noptional.  If you don\u2019t check the box to enable a snapshot <em>and<\/em>\nchoose which camera or cameras to take a snapshot, then you won\u2019t\nsee a snapshot in the alert e-mail.<\/p>\n\n\n\n<p>You\nwill likely want camera 1 to take a snapshot if there is motion\ndetected on camera 1.  You can also cause other cameras to take\nsnapshots when there is motion on camera 1.  If you do, you will get\n<em>separate<\/em> alert e-mails, each with a single snapshot rather\nthan one e-mail with multiple snapshots.  Suppose you choose cameras\n1, 2 and 3 to take a snapshot when motion is detected on camera 1. \nYou will get three alert e-mails, and each will show the alert came\nfrom camera 1.  One e-mail will show the snapshot from camera 1,\nanother the snapshot from camera 2, and another the snapshot from\ncamera 3.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Automated Script<\/h4>\n\n\n\n<p>When\nmy Lorex NVR sends an alert e-mail, it is received at the e-mail\naccount I created at my web server.  The e-mail filter I created\n\u201cpipes\u201d the message to my script, which reads and processes the\ne-mail.  It first saves the attached full-size snapshot to a\ndirectory on my server.  It also creates a thumbnail of the original\nsnapshot.  Finally it creates a new e-mail, which it sends to my\nregular e-mail account.  I can include other recipients as well to\nbroadcast the same alert to different people.<\/p>\n\n\n\n<p>This\nnew e-mail has the thumbnail image, as well as the pertinent\ninformation about the motion event like channel (camera number) and\nthe date and time it occurred.  It effectively \u201cforwards\u201d the\nalert, but it is a new e-mail and not actually a forwarded e-mail. \nThis solves the problem of alerts appearing out of order in my inbox.<\/p>\n\n\n\n<p>Due\nto the small thumbnail image, the \u201cforwarded\u201d alert I receive at\nmy personal e-mail account is relatively small compared to the\noriginal snapshot.  That solves the problem of huge bandwidth with\nthe original Lorex NVR alerts.<\/p>\n\n\n\n<p>The\nthumbnail is a link to the original image stored on my server.  So if\nI see something suspicious, I can click on it.  That opens my web\nbrowser and displays a web page.  That page in turn is generated by a\nsecond script, which simply displays the original snapshot image. \nMost motion detection events can be dismissed just by looking at the\nthumbnail.  There is usually no need to see the full-size snapshot.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Viewing\nthe Original Snapshot<\/h4>\n\n\n\n<p>Here\nis the web page I see when I click on the thumbnail in my \u201cforwarded\u201d\nalert e-mail.  The image is blurred here for privacy, but it\u2019s the\noriginal snapshot image, scaled down somewhat.  I can click on it to\nenlarge it to full size if necessary.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"900\" height=\"601\" src=\"http:\/\/home.iseeancestors.com\/blog\/wp-content\/uploads\/email-snapshot.jpg\" alt=\"Snapshot\" class=\"wp-image-252\" srcset=\"https:\/\/home.iseeancestors.com\/blog\/wp-content\/uploads\/email-snapshot.jpg 900w, https:\/\/home.iseeancestors.com\/blog\/wp-content\/uploads\/email-snapshot-300x200.jpg 300w, https:\/\/home.iseeancestors.com\/blog\/wp-content\/uploads\/email-snapshot-768x513.jpg 768w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/figure>\n\n\n\n<p>The\ndate and time when the motion event occurred is shown along with the\nchannel (camera number) and camera name.  This is parsed from the\noriginal snapshot\u2019s file name, which gives the channel,\nyear-month-day and hour-minute-second:<\/p>\n\n\n\n<p class=\"has-text-color has-text-align-center has-vivid-red-color\">ch01_20190103_152715_E.jpg<\/p>\n\n\n\n<p>I\nhave other buttons on the page to view the prior or next snapshot. \nThey simply submit a request to my script to display either the\nprevious or the next image, in order by timestamp.  A third button\nrequests the most recent snapshot processed.  So from any given alert\ne-mail, I can review all the snapshots that have been processed.<\/p>\n\n\n\n<p>The\nfinal step for my e-mail processing script is to periodically delete\nsnapshots from the server.  It deletes snapshots over a week old to\nfree up disk space on the server.  That gives me enough time to\nreview the alerts before they\u2019re deleted.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Suspending\nAlerts<\/h4>\n\n\n\n<p>When\nI want to suspend alerts, I send an e-mail to the same \u201cReceiver\u201d\naddress to which the NVR sends alerts.  The subject of the e-mail is\na command for my script, like \u201cSet Motion Off\u201d or \u201cSet Motion\nOn.\u201d  The script sets a flag to enable or disable forwarding\nsubsequent alert e-mails.  When alerts are suspended, the script\ncontinues to save the snapshot attachments it gets.  It simply does\nnot \u201cforward\u201d them to my regular address.  That way I can go back\nto review any snapshots I missed.  For instance I\u2019m not bothered by\ndozens of e-mail alerts when I\u2019m out mowing my lawn.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Conclusion<\/h4>\n\n\n\n<p>The\ne-mail alert feature of the Lorex NVR may be useful under certain\nconditions.  If you do enable it, consider pre-processing the\nsnapshots using your website\u2019s e-mail filter and scripting\nfacilities.  Store the original snapshots at your web server and send\nnew e-mails with just thumbnail images.  That saves bandwidth and\nresources on your regular e-mail account and ensures you see your\nmessages in the order they are received.  A link to a simple web page\ncan show the original snapshot if needed.<\/p>\n\n\n\n<p>Technical\npointers:  I wrote my scripts using PHP.  I used \u201cmailReader\u201d to\nparse the original e-mail alert sent from the NVR to my e-mail\naccount at my web server.  I then used the \u201cPHPMailer\u201d class to\nsend alert e-mails from my script to my personal e-mail account. \nBoth are excellent pre-made scripts that handle the detailed\nprocessing.<\/p>\n\n\n\n<p><strong>UPDATE:<\/strong>  The scripts I describe in this article are now available for download.  See <a href=\"http:\/\/home.iseeancestors.com\/blog\/2020\/03\/23\/how-to-home-automation-scripts\/\">How-To:  Home Automation Scripts<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A review of the Lorex e-mail notification feature.  Alerts are automated to save bandwidth and fix a bug.<\/p>\n","protected":false},"author":65,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35,17,9,16],"tags":[32,28,29,26,27],"class_list":["post-241","post","type-post","status-publish","format-standard","hentry","category-how-to","category-review","category-software","category-technology","tag-automation","tag-camera","tag-lorex","tag-security","tag-surveillance"],"_links":{"self":[{"href":"https:\/\/home.iseeancestors.com\/blog\/wp-json\/wp\/v2\/posts\/241","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/home.iseeancestors.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/home.iseeancestors.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/home.iseeancestors.com\/blog\/wp-json\/wp\/v2\/users\/65"}],"replies":[{"embeddable":true,"href":"https:\/\/home.iseeancestors.com\/blog\/wp-json\/wp\/v2\/comments?post=241"}],"version-history":[{"count":6,"href":"https:\/\/home.iseeancestors.com\/blog\/wp-json\/wp\/v2\/posts\/241\/revisions"}],"predecessor-version":[{"id":272,"href":"https:\/\/home.iseeancestors.com\/blog\/wp-json\/wp\/v2\/posts\/241\/revisions\/272"}],"wp:attachment":[{"href":"https:\/\/home.iseeancestors.com\/blog\/wp-json\/wp\/v2\/media?parent=241"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/home.iseeancestors.com\/blog\/wp-json\/wp\/v2\/categories?post=241"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/home.iseeancestors.com\/blog\/wp-json\/wp\/v2\/tags?post=241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}