m0603papko 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.
- package/.idea/lab03.iml +12 -0
- package/.idea/modules.xml +8 -0
- package/06-03.js +3 -0
- package/m0603.js +35 -0
- package/package.json +18 -0
package/.idea/lab03.iml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="WEB_MODULE" version="4">
|
3
|
+
<component name="NewModuleRootManager">
|
4
|
+
<content url="file://$MODULE_DIR$">
|
5
|
+
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
6
|
+
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
7
|
+
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
8
|
+
</content>
|
9
|
+
<orderEntry type="inheritedJdk" />
|
10
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
11
|
+
</component>
|
12
|
+
</module>
|
package/06-03.js
ADDED
package/m0603.js
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
const nodemailer = require('nodemailer');
|
2
|
+
|
3
|
+
// Конфигурация SMTP
|
4
|
+
const transporter = nodemailer.createTransport({
|
5
|
+
host: 'smtp.mail.ru',
|
6
|
+
port: 465,
|
7
|
+
secure: true,
|
8
|
+
auth: {
|
9
|
+
user: 'papkonikita@mail.ru',
|
10
|
+
pass: 'C90LTrJpVNEJpNdG5wDz', // Пароль приложения
|
11
|
+
}
|
12
|
+
});
|
13
|
+
|
14
|
+
// Фиксированный email получателя
|
15
|
+
const RECIPIENT_EMAIL = 'alantiuring@gmail.com';
|
16
|
+
|
17
|
+
// Функция send
|
18
|
+
function send(message) {
|
19
|
+
const mailOptions = {
|
20
|
+
from: 'papkonikita@mail.ru', // Отправитель
|
21
|
+
to: RECIPIENT_EMAIL, // Получатель
|
22
|
+
subject: 'Сообщение из приложения', // Тема
|
23
|
+
text: message // Текст письма
|
24
|
+
};
|
25
|
+
|
26
|
+
transporter.sendMail(mailOptions, (err, info) => {
|
27
|
+
if (err) {
|
28
|
+
console.error('Ошибка отправки:', err);
|
29
|
+
} else {
|
30
|
+
console.log('Письмо отправлено. ID:', info.messageId);
|
31
|
+
}
|
32
|
+
});
|
33
|
+
}
|
34
|
+
|
35
|
+
module.exports = { send };
|
package/package.json
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
{
|
2
|
+
"name": "m0603papko",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"private": false,
|
5
|
+
"description": "",
|
6
|
+
"keywords": [],
|
7
|
+
"license": "ISC",
|
8
|
+
"author": "nikita",
|
9
|
+
"type": "commonjs",
|
10
|
+
"main": "m0603.js",
|
11
|
+
"scripts": {
|
12
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
13
|
+
},
|
14
|
+
"dependencies": {
|
15
|
+
"nodemailer": "^6.10.0"
|
16
|
+
},
|
17
|
+
"devDependencies": {}
|
18
|
+
}
|