m0603_kotovich2 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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$/temp" />
6
+ <excludeFolder url="file://$MODULE_DIR$/.tmp" />
7
+ <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
+ </content>
9
+ <orderEntry type="inheritedJdk" />
10
+ <orderEntry type="sourceFolder" forTests="false" />
11
+ </component>
12
+ </module>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/m0603.iml" filepath="$PROJECT_DIR$/.idea/m0603.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
package/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$/.." vcs="Git" />
5
+ </component>
6
+ </project>
package/index.js ADDED
@@ -0,0 +1,30 @@
1
+ const nodemailer = require('nodemailer');
2
+
3
+ function send(from, password, to, message) {
4
+ let transporter = nodemailer.createTransport({
5
+ host: "smtp.mail.ru",
6
+ port: 465,
7
+ secure: true,
8
+ auth: {
9
+ user: from,
10
+ pass: password
11
+ }
12
+ });
13
+
14
+ let mailOptions = {
15
+ from: from,
16
+ to: to,
17
+ subject: 'Message from m0603 module',
18
+ text: message
19
+ };
20
+
21
+ transporter.sendMail(mailOptions, (error, info) => {
22
+ if (error) {
23
+ console.log(error);
24
+ } else {
25
+ console.log('Message sent: %s', info.messageId);
26
+ }
27
+ });
28
+ }
29
+
30
+ module.exports = { send };
package/package.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "m0603_kotovich2",
3
+ "version": "1.0.0",
4
+ "description": "m0603 package for sending message through nodemailer",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": [],
10
+ "author": "ksun",
11
+ "license": "ISC",
12
+ "dependencies": {
13
+ "express": "^4.18.2",
14
+ "nodemailer": "^6.9.1"
15
+ },
16
+ "devDependencies": {}
17
+ }