m603_u0ffer 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/m603.js +28 -0
- package/package.json +16 -0
package/m603.js
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
const nodemailer = require('nodemailer');
|
2
|
+
|
3
|
+
require('dotenv').config();
|
4
|
+
|
5
|
+
const EMAIL_SENDER = process.env.EMAIL_SENDER;
|
6
|
+
const EMAIL_PASSWORD = process.env.EMAIL_PASSWORD;
|
7
|
+
const EMAIL_RECEIVER = process.env.EMAIL_RECEIVER;
|
8
|
+
|
9
|
+
module.exports.send = async function (message) {
|
10
|
+
const transporter = nodemailer.createTransport({
|
11
|
+
host: 'smtp.gmail.com',
|
12
|
+
port: 465,
|
13
|
+
secure: true,
|
14
|
+
auth: {
|
15
|
+
user: EMAIL_SENDER,
|
16
|
+
pass: EMAIL_PASSWORD,
|
17
|
+
},
|
18
|
+
});
|
19
|
+
|
20
|
+
const info = await transporter.sendMail({
|
21
|
+
from: EMAIL_SENDER,
|
22
|
+
to: EMAIL_RECEIVER,
|
23
|
+
subject: 'Message from Node.js',
|
24
|
+
text: message,
|
25
|
+
});
|
26
|
+
|
27
|
+
return info;
|
28
|
+
}
|
package/package.json
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
{
|
2
|
+
"name": "m603_u0ffer",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "",
|
5
|
+
"main": "m603/m603.js",
|
6
|
+
"scripts": {
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
8
|
+
},
|
9
|
+
"keywords": [],
|
10
|
+
"author": "u0ffer",
|
11
|
+
"license": "ISC",
|
12
|
+
"dependencies": {
|
13
|
+
"dotenv": "^16.0.3",
|
14
|
+
"nodemailer": "^6.8.0"
|
15
|
+
}
|
16
|
+
}
|