فهرست منبع

update mail info

guoziyun 8 ماه پیش
والد
کامیت
4a94aa57c5
1فایلهای تغییر یافته به همراه20 افزوده شده و 18 حذف شده
  1. 20 18
      libs/utils/mail.js

+ 20 - 18
libs/utils/mail.js

@@ -1,57 +1,59 @@
 "use strict";
 const nodemailer = require("nodemailer");
 
-
-
 let DEFAULT_DATA = {
   //from: '通知<webmaster@ikamaza.com>',
-  from: 'Monitor<pcoloring@ikamaza.com>',
+  // from: 'PCOLORING<pcoloring@ikamaza.com>',
+  from: "Monitor<pcoloring@kizimail.com>",
   to: "chengen@jccy-tech.com", // list of receivers
-  subject: '无标题',
+  subject: "无标题",
   text: "无内容", // plain text body
   //html: "<b>Hello world?</b>", // html body
-}
+};
 
 async function send(mail) {
   let transporter = nodemailer.createTransport({
-    host: "mail.ikamaza.com",
+    // host: 'mail.ikamaza.com', // 废弃
+    host: "mail.kizimail.com",
     port: 587,
     secure: false, // true for 465, false for other ports
     auth: {
-      user: 'mailer', // generated ethereal user
-      pass: 'Mailer@Jccy2017.', // generated ethereal password
+      // user: 'mailer', // generated ethereal user
+      // pass: 'Mailer@Jccy2017.', // generated ethereal password
+      user: "pcoloring@kizimail.com", // generated ethereal user
+      pass: "0,k)Mf25T#AX3*=", // generated ethereal password
     },
   });
 
-
   let data = JSON.parse(JSON.stringify(DEFAULT_DATA));
   data = Object.assign(data, mail);
   try {
     let info = await transporter.sendMail(data);
-    console.log('Mail', data);
+    console.log("Mail", data);
     console.log("Message sent: %s", info.messageId);
     // Message sent: <b658f8ca-6296-ccf4-8306-87d57a0b4321@example.com>
-  
+
     // Preview only available when sending through an Ethereal account
     console.log("Preview URL: %s", nodemailer.getTestMessageUrl(info));
     return info;
-  } catch(err) {
+  } catch (err) {
     console.error(err);
   }
-  
 }
 
-
 module.exports = {
   send,
-}
+};
 
 if (require.main == module) {
   send({
-    subject: 'hello:' + new Date(),
-    text: 'hello',
+    to: "guoziyun@jccy-tech.com",
+    subject: "hello:" + new Date(),
+    text: "hello new",
     //attachments: [{
     //  path: './mail.js',
     //}]
-  }).then(console.log).catch(console.error);
+  })
+    .then(console.log)
+    .catch(console.error);
 }