m0603imazenkova 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/m0603.js +34 -0
- package/package.json +16 -0
package/m0603.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const nodemailer=require ('nodemailer');
|
|
2
|
+
const smtpTransport = require('nodemailer-smtp-transport');
|
|
3
|
+
|
|
4
|
+
const sender="irinamazenkova2@gmail.com";
|
|
5
|
+
let receiver ="irinamazenkovaa@gmail.com";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
module.exports.send = function(message){
|
|
10
|
+
let transporter = nodemailer.createTransport(smtpTransport(
|
|
11
|
+
{
|
|
12
|
+
host:'smtp.gmail.com',
|
|
13
|
+
port:465,
|
|
14
|
+
service:'gmail',
|
|
15
|
+
secure: false,
|
|
16
|
+
auth:{
|
|
17
|
+
user: sender,
|
|
18
|
+
pass:'zuaugxofplfoaarn'
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
));
|
|
22
|
+
|
|
23
|
+
var mailOptions={
|
|
24
|
+
from: sender,
|
|
25
|
+
to: receiver,
|
|
26
|
+
subject: 'lab6',
|
|
27
|
+
text:`Message info:${new Date().toLocaleString()}\nMessage:\n${message}`
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
transporter.sendMail(mailOptions, function (error, info) {
|
|
31
|
+
error ? console.log(error) : console.log('Email sent: ' + info.response);
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "m0603imazenkova",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "lab6 Node.js",
|
|
5
|
+
"main": "m0603.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"author": "Imazenkova (irinamazenkova2@gmail.com)",
|
|
10
|
+
"license": "ISC",
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"nodemailer": "^6.6.5",
|
|
13
|
+
"nodemailer-smtp-transport": "^2.7.4"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {}
|
|
16
|
+
}
|