{"id":256,"date":"2015-07-24T12:32:01","date_gmt":"2015-07-24T11:32:01","guid":{"rendered":"http:\/\/www.sarbyn.com\/tech\/?p=256"},"modified":"2015-07-24T12:32:38","modified_gmt":"2015-07-24T11:32:38","slug":"send-email-when-webcam-detect-movement","status":"publish","type":"post","link":"https:\/\/www.sarbyn.com\/blog\/2015\/07\/24\/send-email-when-webcam-detect-movement\/","title":{"rendered":"Send email when webcam detects movement"},"content":{"rendered":"<p>In <a href=\"http:\/\/www.sarbyn.com\/tech\/2015\/07\/23\/diy-ip-camera-with-raspberry-pi\/\">my previous post<\/a>\u00a0I&#8217;ve explained how to configure a DIY IP camera using motion.<\/p>\n<p>Now let configure an email alert system that send email upon motion detection and the video recorded. It&#8217;s very simple.<\/p>\n<p>First of all, install some software:<\/p>\n<pre class=\"brush: bash; collapse: false; title: ; notranslate\" title=\"\">\r\nsudo apt-get update\r\nsudo apt-get install sendemail libio-socket-ssl-perl libnet-ssleay-perl\r\n<\/pre>\n<p>If you want to use GMAIL as smtp you need to fix SSL config. Open \/usr\/share\/perl5\/IO\/Socket\/SSL.pm and then change<\/p>\n<pre class=\"brush: plain; collapse: false; title: ; notranslate\" title=\"\">\r\nm{^(!?)(?:(SSL(?:v2|v3|v23|v2\/3))|(TLSv1&#x5B;12]?))$}i\r\n<\/pre>\n<p>to:<\/p>\n<pre class=\"brush: plain; collapse: false; title: ; notranslate\" title=\"\">\r\nm{^(!?)(?:(SSL(?:v2|v3|v23|v2\/3))|(TLSv1&#x5B;12]?))}i\r\n<\/pre>\n<p>Now change motion.conf file.<\/p>\n<pre class=\"brush: plain; collapse: false; title: ; notranslate\" title=\"\">\r\n# email sent when an event starts\r\non_event_start sendEmail -f YOURFROMEMAIL@gmail.com -t YOURTOEMAIL@gmail.com -u &quot;&#x5B;Motion] Event detected&quot; -m &quot;Movement has been detected on: %d %m %Y. The time of the movement was: %H:%M (Hour:Minute). Video will follow&quot; -s smtp.gmail.com -xu YOURGMAIL@gmail.com -xp YOURGMAILPASSWORD -o tls=yes\r\n\r\n# send video as attachment\r\non_movie_end sendEmail -f YOURFROMEMAIL@gmail.com -t YOURTOEMAIL@gmail.com -u &quot;&#x5B;Motion] video&quot; -m &quot;Video&quot; -s smtp.gmail.com -xu YOURGMAIL@gmail.com -xp YOURGMAILPASSWORD -o tls=yes -a %f\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>In my previous post\u00a0I&#8217;ve explained how to configure a DIY IP camera using motion. Now let configure an email alert system that send email upon motion detection and the video recorded. It&#8217;s very simple. First of all, install some software: sudo apt-get update sudo apt-get install sendemail libio-socket-ssl-perl libnet-ssleay-perl If you want to use GMAIL <a class=\"read-more\" href=\"https:\/\/www.sarbyn.com\/blog\/2015\/07\/24\/send-email-when-webcam-detect-movement\/\">&hellip;&nbsp;<span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[43],"tags":[70,68,32,72],"class_list":["post-256","post","type-post","status-publish","format-standard","hentry","category-diy-2","tag-camera","tag-motion","tag-raspberry","tag-sendemail"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3JApm-48","jetpack_likes_enabled":true,"jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/posts\/256"}],"collection":[{"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/comments?post=256"}],"version-history":[{"count":9,"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/posts\/256\/revisions"}],"predecessor-version":[{"id":265,"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/posts\/256\/revisions\/265"}],"wp:attachment":[{"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/media?parent=256"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/categories?post=256"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sarbyn.com\/blog\/wp-json\/wp\/v2\/tags?post=256"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}