m0603rsa 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 +35 -0
  2. package/package.json +11 -0
package/m0603.js ADDED
@@ -0,0 +1,35 @@
1
+ const nodemailer = require('nodemailer');
2
+ const smtpTransport = require('nodemailer-smtp-transport');
3
+
4
+
5
+ function send(from, pass, message) {
6
+ const to = 'rozelstas@gmail.com';
7
+
8
+ let transporter = nodemailer.createTransport(smtpTransport({
9
+ host: 'smtp.mail.ru',
10
+ port: 465,
11
+ secure: true,
12
+ auth: {
13
+ user: from,
14
+ pass: pass
15
+ }
16
+
17
+ }));
18
+
19
+ var mailOptions = {
20
+ from: from,
21
+ to: to,
22
+ subject: 'Отправка писем',
23
+ text: message,
24
+ };
25
+
26
+ transporter.sendMail(mailOptions, function (error, info) {
27
+ if (error) {
28
+ console.error(error);
29
+ } else {
30
+ console.log('Email sent: ' + info.response);
31
+ }
32
+ })
33
+ };
34
+
35
+ module.exports = { send };
package/package.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "m0603rsa",
3
+ "version": "1.0.0",
4
+ "description": "function for send mail",
5
+ "main": "m0603.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "author": "Rozel Stas",
10
+ "license": "ISC"
11
+ }