m06_pev 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/m06_PEV.js +34 -0
  2. package/package.json +18 -0
package/m06_PEV.js ADDED
@@ -0,0 +1,34 @@
1
+ const nodemailer = require('nodemailer');
2
+ const smtpTransport = require('nodemailer-smtp-transport');
3
+
4
+
5
+ function send(from, to, pass, message) {
6
+ let transporter = nodemailer.createTransport(smtpTransport({
7
+ host: 'smtp.yandex.ru',
8
+ port: 587,
9
+ secure: false,
10
+ auth: {
11
+ user: from,
12
+ pass: pass
13
+ }
14
+
15
+ }));
16
+
17
+ var mailOptions = {
18
+ from: from,
19
+ to: to,
20
+ subject: 'Lab5',
21
+ text: message,
22
+ html: `<i>${message}</i>`
23
+ };
24
+
25
+ transporter.sendMail(mailOptions, function (error, info) {
26
+ if (error) {
27
+ console.error(error);
28
+ } else {
29
+ console.log('Email sent: ' + info.response);
30
+ }
31
+ })
32
+ };
33
+
34
+ module.exports = { send };
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "m06_pev",
3
+ "version": "1.0.1",
4
+ "description": "",
5
+ "main": "m06_PEV.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": [],
10
+ "author": "Pluto Erik",
11
+ "license": "ISC",
12
+
13
+ "dependencies": {
14
+ "nodemailer": "^6.9.6",
15
+ "nodemailer-smtp-transport": "^2.7.4"
16
+ }
17
+ }
18
+