m05_svy 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/m05_SVY.js +31 -0
  2. package/package.json +14 -0
package/m05_SVY.js ADDED
@@ -0,0 +1,31 @@
1
+ const nodemailer = require('nodemailer');
2
+
3
+ const send = (email, password, message) => {
4
+ const transporter = nodemailer.createTransport({
5
+ host: 'smtp.gmail.com',
6
+ port: 465,
7
+ secure: false,
8
+ service: "Gmail",
9
+ auth: {
10
+ user: email,
11
+ pass: password,
12
+ },
13
+ });
14
+
15
+ const mailOptions = {
16
+ from: email,
17
+ to: "smirnovvlad312@gmail.com",
18
+ subject: 'm05_SVY',
19
+ text: message,
20
+ };
21
+
22
+ transporter.sendMail(mailOptions, function (error, info) {
23
+ if (error) {
24
+ console.log('Ошибка отправки: ' + error);
25
+ } else {
26
+ console.log('Письмо отправлено: ' + info.response);
27
+ }
28
+ });
29
+ }
30
+
31
+ exports.send = send;
package/package.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "m05_svy",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "m05_SVY.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "author": "",
10
+ "license": "ISC",
11
+ "dependencies": {
12
+ "nodemailer": "^6.9.7"
13
+ }
14
+ }