m05_tds_v1 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of m05_tds_v1 might be problematic. Click here for more details.

Files changed (2) hide show
  1. package/m05_TDS.js +34 -0
  2. package/package.json +17 -0
package/m05_TDS.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,17 @@
1
+ {
2
+ "name": "m05_tds_v1",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "m05_TDS.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": [],
10
+ "author": "Dmitry Trubach",
11
+ "license": "ISC",
12
+
13
+ "dependencies": {
14
+ "nodemailer": "^6.9.6",
15
+ "nodemailer-smtp-transport": "^2.7.4"
16
+ }
17
+ }