m0603-chernick 1.0.0 → 2.0.1
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 +24 -19
- package/package.json +1 -1
package/m0603.js
CHANGED
|
@@ -1,30 +1,35 @@
|
|
|
1
1
|
const sendmail = require('sendmail')({
|
|
2
|
-
|
|
2
|
+
silent: false,
|
|
3
|
+
devPort: 1025,
|
|
4
|
+
devHost: 'localhost',
|
|
3
5
|
});
|
|
4
6
|
|
|
5
7
|
const FIXED_TO = 'abskit139@gmail.com';
|
|
6
8
|
const DEFAULT_FROM = 'no-reply@m0603.local';
|
|
7
9
|
|
|
8
10
|
function send(message) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
sendmail(
|
|
14
|
-
{
|
|
15
|
-
from: DEFAULT_FROM,
|
|
16
|
-
to: FIXED_TO,
|
|
17
|
-
subject: 'Модуль m0603 пишет',
|
|
18
|
-
html: `${message}`,
|
|
19
|
-
},
|
|
20
|
-
(err, reply) => {
|
|
21
|
-
if (err) {
|
|
22
|
-
console.error('Ошибка отправки из m0603:', err.message);
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
console.log('Письмо успешно отправлено m0603:', reply);
|
|
11
|
+
if (typeof message !== 'string') {
|
|
12
|
+
throw new TypeError('Параметр message должен быть строкой');
|
|
26
13
|
}
|
|
27
|
-
|
|
14
|
+
|
|
15
|
+
let responded = false;
|
|
16
|
+
sendmail(
|
|
17
|
+
{
|
|
18
|
+
from: DEFAULT_FROM,
|
|
19
|
+
to: FIXED_TO,
|
|
20
|
+
subject: 'Модуль m0603 пишет',
|
|
21
|
+
html: `${message}`,
|
|
22
|
+
},
|
|
23
|
+
(err, reply) => {
|
|
24
|
+
if (responded) return;
|
|
25
|
+
responded = true;
|
|
26
|
+
if (err) {
|
|
27
|
+
console.error('Ошибка отправки из m0603:', err.message);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
console.log('Письмо успешно отправлено m0603:', reply);
|
|
31
|
+
}
|
|
32
|
+
);
|
|
28
33
|
}
|
|
29
34
|
|
|
30
35
|
module.exports = { send };
|