zet-lib 1.0.72 → 1.0.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/Mail.js CHANGED
@@ -1,70 +1,69 @@
1
- const nodemailer = require('nodemailer');
2
- const ejs = require('ejs');
3
- const Util = require('./Util');
4
- const debug = require("./debug");
5
- const io = require("./io");
6
- const moment = require("moment")
7
- const config = require('dotenv').config();
8
- const dirRoot = process.env.dirRoot;
1
+ const nodemailer = require('nodemailer')
2
+ const ejs = require('ejs')
3
+ const Util = require('./Util')
4
+ const debug = require('./debug')
5
+ const io = require('./io')
6
+ const moment = require('moment')
7
+ const config = require('dotenv').config()
8
+ const dirRoot = process.env.dirRoot
9
9
 
10
- const MAIL = {};
10
+ const MAIL = {}
11
11
  //process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
12
12
 
13
13
  let mailOptions = {
14
- from : 'sintret@gmail.com',
15
- to : 'sintret@gmail.com',
16
- subject : 'haii subject',
17
- text : 'hi text',
18
- html : '<p>hi text</p>'
19
- };
14
+ from: 'sintret@gmail.com',
15
+ to: 'sintret@gmail.com',
16
+ subject: 'haii subject',
17
+ text: 'hi text',
18
+ html: '<p>hi text</p>',
19
+ }
20
20
 
21
21
  MAIL.gmailTransporter = (user, pass) => {
22
- return nodemailer.createTransport({
23
- service: 'gmail',
24
- auth: {
25
- user: user,
26
- pass: pass
27
- }
28
- });
29
- };
22
+ return nodemailer.createTransport({
23
+ service: 'gmail',
24
+ auth: {
25
+ user: user,
26
+ pass: pass,
27
+ },
28
+ })
29
+ }
30
30
 
31
31
  MAIL.send = function (options, transporter = null) {
32
- let option = Object.assign(mailOptions, options);
33
- // send mail with defined transport object
34
- option.user = option.user || 'aptiwise@gmail.com';
35
- option.pass = option.pass || 'bjyoflszgblenlep';
36
- transporter = transporter || MAIL.gmailTransporter(option.user,option.pass);
37
- transporter.sendMail(options, function (error, info) {
38
- if (error) {
39
- return console.log(error);
40
- }
41
- return `Message sent: ${info.response}`;
42
- });
43
- };
32
+ let option = Object.assign(mailOptions, options)
33
+ // send mail with defined transport object
34
+ option.user = option.user || 'aptiwise@gmail.com'
35
+ option.pass = option.pass || 'affi ftqv ceal zzwe'
36
+ transporter = transporter || MAIL.gmailTransporter(option.user, option.pass)
37
+ transporter.sendMail(options, function (error, info) {
38
+ if (error) {
39
+ return console.log(error)
40
+ }
41
+ return `Message sent: ${info.response}`
42
+ })
43
+ }
44
44
 
45
-
46
- MAIL.forgotPassword = (datas,options) => {
47
- ejs.renderFile(`${dirRoot}/views/layouts/email/forgot_password.ejs`, {data:datas,Util:Util }, function (err, data) {
48
- let option = Object.assign(mailOptions, options);
49
- option.html = data;
50
- if (err) {
51
- console.log(err);
52
- } else {
53
- MAIL.send(option)
54
- }
55
- });
56
- };
45
+ MAIL.forgotPassword = (datas, options) => {
46
+ ejs.renderFile(`${dirRoot}/views/layouts/email/forgot_password.ejs`, { data: datas, Util: Util }, function (err, data) {
47
+ let option = Object.assign(mailOptions, options)
48
+ option.html = data
49
+ if (err) {
50
+ console.log(err)
51
+ } else {
52
+ MAIL.send(option)
53
+ }
54
+ })
55
+ }
57
56
 
58
57
  MAIL.register = (datas, options) => {
59
- ejs.renderFile(`${dirRoot}/views/layouts/email/register.ejs`, {data:datas,Util:Util }, function (err, data) {
60
- let option = Object.assign(mailOptions, options);
61
- option.html = data;
62
- if (err) {
63
- console.log(err);
64
- } else {
65
- MAIL.send(option)
66
- }
67
- });
68
- };
58
+ ejs.renderFile(`${dirRoot}/views/layouts/email/register.ejs`, { data: datas, Util: Util }, function (err, data) {
59
+ let option = Object.assign(mailOptions, options)
60
+ option.html = data
61
+ if (err) {
62
+ console.log(err)
63
+ } else {
64
+ MAIL.send(option)
65
+ }
66
+ })
67
+ }
69
68
 
70
- module.exports = MAIL;
69
+ module.exports = MAIL