mymodulealinafortask 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/m0603.js +28 -0
- package/package.json +11 -0
package/m0603.js
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
const nodemailer = require('nodemailer');
|
2
|
+
const receiver = 'alina.sevryuk0708@gmail.com';
|
3
|
+
|
4
|
+
function send (mailAddr, mailPass, message)
|
5
|
+
{
|
6
|
+
const transporter = nodemailer.createTransport({
|
7
|
+
host: 'smtp.gmail.com',
|
8
|
+
port: 465,
|
9
|
+
secure: false,
|
10
|
+
service: 'Gmail',
|
11
|
+
auth: {
|
12
|
+
user: mailAddr,
|
13
|
+
pass: mailPass
|
14
|
+
}
|
15
|
+
});
|
16
|
+
const mailOptions = {
|
17
|
+
from: mailAddr,
|
18
|
+
to: receiver,
|
19
|
+
subject: 'hello!!!',
|
20
|
+
text: message
|
21
|
+
}
|
22
|
+
|
23
|
+
transporter.sendMail(mailOptions, (err, info) => {
|
24
|
+
err ? console.log(err) : console.log('Sent: ' + info.response);
|
25
|
+
})
|
26
|
+
}
|
27
|
+
|
28
|
+
module.exports = send;
|