<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      用Nodemailer發(fā)個(gè)郵件不算難?


      公司一直用郵箱做一些部門間協(xié)調(diào)的溝通留存,于是乎想用點(diǎn)“編程思維”做些“工作流”來(lái)自動(dòng)化處理;但是公司用的郵箱有點(diǎn)難登吶!

       選用的Nodejs 作為實(shí)現(xiàn)語(yǔ)言,那就用Nodemailer來(lái)發(fā)吧 

      上Demo代碼測(cè)試一下

      const nodemailer = require("nodemailer");// async..await is not allowed in global scope, must use a wrapper
      async function main() {
        // Generate test SMTP service account from ethereal.email
        // Only needed if you don't have a real mail account for testing
        // let testAccount = await nodemailer.createTestAccount();
      
        // create reusable transporter object using the default SMTP transport
        let transporter = nodemailer.createTransport({
          host: "mail.***.com.cn",
          port: 587,
          secure: false, // true for 465, false for other ports
          auth: {
              user: 'username', // generated ethereal user
              pass: '********', // generated ethereal password
          },
          ignoreTLS: true,
        });
      
        // send mail with defined transport object
        let info = await transporter.sendMail({
          from: '"Jimmy ??" <**@**.com.cn>', // sender address
          to: "***@**.com.cn", // list of receivers
          subject: "Hello ?", // Subject line
          text: "Hello world?", // plain text body
          html: "<b>Hello world?</b>", // html body
          date: new Date('2021-03-30 23:59:59'),
        });
      
        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));
        // Preview URL: https://ethereal.email/message/WaQKMgKddxQDoou...
      }
      
      main().catch(console.error);

      但等都登不上去  哈哈哈哈果然是難得順利

      于是乎開(kāi)始全網(wǎng)查資料.....

      終于查到一些思緒

      需要使用telnet登上服務(wù)器看看

      telnet  smtp.****.com.cn 587
      Connected to mail.****.cn.
      Escape character is '^]'.
      220 ex01.***.cn Microsoft ESMTP MAIL Service ready at Fri, 23 Apr 2021 18:08:13 +0800
      ehlo
      250-ex01.****.cn Hello [123.233.***.***]
      250-SIZE 1073741824
      250-PIPELINING
      250-DSN
      250-ENHANCEDSTATUSCODES
      250-STARTTLS
      250-X-ANONYMOUSTLS
      250-AUTH GSSAPI NTLM
      250-X-EXPS GSSAPI NTLM
      250-8BITMIME
      250-BINARYMIME
      250-CHUNKING
      250 XRDST

       

       

       

      原來(lái)如此  和一般的是不太一樣  

      繼續(xù)面向搜索引擎編程~~

      找來(lái)找去沒(méi)有比較好的輪子,差點(diǎn)就像自己來(lái)造起了

       

      在翻翻文檔瞧瞧

       

       

      發(fā)現(xiàn)了個(gè)實(shí)現(xiàn)過(guò)的輪子 wow~

      最終經(jīng)過(guò)一番調(diào)教終于收到自己給自己發(fā)送的郵件

      const nodemailer = require("nodemailer");
      const nodemailerNTLMAuth = require('nodemailer-ntlm-auth');
      
      // async..await is not allowed in global scope, must use a wrapper
      async function main() {
        // Generate test SMTP service account from ethereal.email
        // Only needed if you don't have a real mail account for testing
        // let testAccount = await nodemailer.createTestAccount();
      
        // create reusable transporter object using the default SMTP transport
        let transporter = nodemailer.createTransport({
          host: "smtp.****.com.cn",
          port: 587,
          secure: false, // true for 465, false for other ports
          auth: {
              type: 'custom',
              method: 'NTLM',
              user: 'username', // generated ethereal user
              pass: '*******', // generated ethereal password
          },
          ignoreTLS: true,
          customAuth: {
              NTLM: nodemailerNTLMAuth,
          }
        });
      
        // send mail with defined transport object
        let info = await transporter.sendMail({
          from: '"Jimmy ??" <*****@*****.com.cn>', // sender address
          to: "***@***.com.cn", // list of receivers
          subject: "Hello ?", // Subject line
          text: "Hello world?", // plain text body
          html: "<b>Hello world?</b>", // html body
          date: new Date('2021-03-30 23:59:59'),
        });
      
        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));
        // Preview URL: https://ethereal.email/message/WaQKMgKddxQDoou...
      }
      
      main().catch(console.error);

      打印郵件ID

      Message sent: <466d4875-00e7-e9fa-11dd-e6b65d1b023f@***.com.cn>

      OK!待續(xù)

      EOF

       

      posted @ 2021-04-25 10:51  jso0  閱讀(130)  評(píng)論(0)    收藏  舉報(bào)
      主站蜘蛛池模板: 山东省| 久久ww精品w免费人成| 国产成人a∨激情视频厨房| 亚洲欧美综合中文| 国产精品久久久久鬼色| 久久精品蜜芽亚洲国产av| 综合久久av一区二区三区| 国产精品自在线拍国产手机版| 人妻中文字幕精品系列| 激情综合五月丁香亚洲| 精品国产高清中文字幕| 欧美日产国产精品日产| 国产精欧美一区二区三区| 视频一区视频二区中文字幕| 人人妻人人狠人人爽天天综合网| 爱性久久久久久久久| 九九热在线免费视频观看| 亚洲成a人无码av波多野| 一区二区三区av天堂| www插插插无码免费视频网站| 国产第一区二区三区精品| 免费看黄片一区二区三区| 亚洲AV永久无码天堂网一线| 最新亚洲av日韩av二区| 免费特黄夫妻生活片| 日韩精品在线观看一二区| 砀山县| 久久99精品久久久久久9| 亚洲人成网站在线观看播放不卡 | 99久久国产露脸国语对白| 日韩午夜福利片段在线观看| 集贤县| 亚洲avav天堂av在线网爱情| 人妻少妇一区二区三区| 国内精品久久久久影视| 1区2区3区4区产品不卡码网站| 兴山县| 白丝乳交内射一二三区| 国产女人看国产在线女人| 一个色的导航| 免费超爽大片黄|