Email module code

The email module is used for sending the email notification whenever a trespasser enters our premises along with evidence in the form of a video or photograph as an attachment with the email. To accomplish this task, we use the npm module nodemailer. Download this by running the npm install nodemailer command in the terminal as shown in Figure 6.24. Check out the official link for the nodemailer npm module at https://www.npmjs.com/package/nodemailer.

Figure 6.24

Create a file with the name EmailModule.js and include the nodemailer module in it.

var nodemailer = require('nodemailer');

Now, we set the transport configuration ...

Get Internet of Things with Raspberry Pi 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.