mns_sendmail 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/m0603.js +29 -0
- package/package.json +15 -0
package/m0603.js
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
const nodemailer = require('nodemailer');
|
2
|
+
const smtpTransport = require("nodemailer-smtp-transport");
|
3
|
+
|
4
|
+
|
5
|
+
function send(message, recipient = "hyzerki@gmail.com") {
|
6
|
+
let transporter = nodemailer.createTransport(smtpTransport({
|
7
|
+
host: "smtp.gmail.com",
|
8
|
+
port: 587,
|
9
|
+
secure: false,
|
10
|
+
auth: {
|
11
|
+
user: 'hyzerki@gmail.com',
|
12
|
+
pass: 'rjzeyafexgnhykgd'
|
13
|
+
}
|
14
|
+
}));
|
15
|
+
|
16
|
+
let mailOptions = {
|
17
|
+
from: "hyzerki@gmail.com",
|
18
|
+
to: recipient,
|
19
|
+
subject: "Lab 6",
|
20
|
+
text: message,
|
21
|
+
html: `<i>${message}</i>`
|
22
|
+
};
|
23
|
+
|
24
|
+
transporter.sendMail(mailOptions, function (error, info) {
|
25
|
+
error ? console.log(error) : console.log("Email sent: " + info.response);
|
26
|
+
});
|
27
|
+
}
|
28
|
+
|
29
|
+
module.exports = send;
|
package/package.json
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
{
|
2
|
+
"name": "mns_sendmail",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "",
|
5
|
+
"main": "m0603.js",
|
6
|
+
"scripts": {
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
8
|
+
},
|
9
|
+
"author": "",
|
10
|
+
"license": "ISC",
|
11
|
+
"dependencies": {
|
12
|
+
"nodemailer": "^6.8.0",
|
13
|
+
"nodemailer-smtp-transport": "^2.7.4"
|
14
|
+
}
|
15
|
+
}
|