m0603-chernick 0.0.0-stage → 2.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.
- package/m0603.js +32 -0
- package/package.json +14 -4
- package/README.md +0 -3
package/m0603.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const sendmail = require('sendmail')({
|
|
2
|
+
silent: false,
|
|
3
|
+
devPort: 1025,
|
|
4
|
+
devHost: 'localhost',
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const FIXED_TO = 'abskit139@gmail.com';
|
|
8
|
+
const DEFAULT_FROM = 'no-reply@m0603.local';
|
|
9
|
+
|
|
10
|
+
function send(message) {
|
|
11
|
+
if (typeof message !== 'string') {
|
|
12
|
+
throw new TypeError('Параметр message должен быть строкой');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
sendmail(
|
|
16
|
+
{
|
|
17
|
+
from: DEFAULT_FROM,
|
|
18
|
+
to: FIXED_TO,
|
|
19
|
+
subject: 'Модуль m0603 пишет',
|
|
20
|
+
html: `${message}`,
|
|
21
|
+
},
|
|
22
|
+
(err, reply) => {
|
|
23
|
+
if (err) {
|
|
24
|
+
console.error('Ошибка отправки из m0603:', err.message);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
console.log('Письмо успешно отправлено m0603:', reply);
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
module.exports = { send };
|
package/package.json
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "m0603-chernick",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "lab06 task03",
|
|
5
|
+
"main": "m0603.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [],
|
|
10
|
+
"author": "Черник Н.Ю.",
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"type": "commonjs",
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"sendmail": "^1.6.1"
|
|
15
|
+
}
|
|
16
|
+
}
|
package/README.md
DELETED