m0603artphresl 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/m0603.js +33 -0
  2. package/package.json +11 -0
package/m0603.js ADDED
@@ -0,0 +1,33 @@
1
+ const nodemailer = require("nodemailer")
2
+ const nodemailer_smtp_transport = require("nodemailer-smtp-transport")
3
+
4
+ let reciever = 'art.rusak@mail.ru'
5
+
6
+ function send(sender, password, message)
7
+ {
8
+ const transporter = nodemailer.createTransport(nodemailer_smtp_transport(
9
+ {
10
+ host: "Smtp.mail.ru",
11
+ port: 465,
12
+ secure: true, // false with port 587 or 25
13
+ auth:
14
+ {
15
+ user: sender,
16
+ pass: password
17
+ }
18
+ }
19
+ ));
20
+
21
+ var mailOptions = {
22
+ from: sender,
23
+ to: reciever,
24
+ text: message
25
+ }
26
+
27
+ transporter.sendMail(mailOptions, function(error, info)
28
+ {
29
+ error ? console.log(error) : console.log ('email sent: ' + info.response);
30
+ })
31
+ }
32
+
33
+ module.exports.send = send;
package/package.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "m0603artphresl",
3
+ "version": "1.0.0",
4
+ "description": "nodemailer",
5
+ "main": "m0603.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "author": "Artyom Rusak",
10
+ "license": "ISC"
11
+ }