美文网首页
邮件轰炸机

邮件轰炸机

作者: cs0710 | 来源:发表于2019-07-27 17:13 被阅读0次
    const koa = require('koa');
    const request = require('request')
    const nodemailer = require('nodemailer');
    
    
    
    const app= new koa();
    
    app.use(async (ctx,next) => {
      nodemailer.createTestAccount((err, account) => {
        let i = 0;
        const timer = setInterval(() => {
          if (i === 100) return clearInterval(timer) 
          i++;
            // create reusable transporter object using the default SMTP transport
            let transporter = nodemailer.createTransport({
              host: 'smtp.163.com',
              port:25,
                  auth: {
                      user: 'xxx@163.com', // generated ethereal user
                      pass: '这是邮箱的授权码,需要开通的'  // generated ethereal password
                  }
              });
        
              // setup email data with unicode symbols
              let mailOptions = {
                  from: '我是xxx', // sender address
                  to: 'xxx@qq.com', // list of receivers
                  subject: '我是xiaochen', // Subject line
                  // text: 'Hello world?', // plain text body
                  html: '<b>请问老铁现在还好吗?</b>' // html body
              };
        
              // send mail with defined transport object
              transporter.sendMail(mailOptions, (error, info) => {
                  if (error) {
                      return console.log(error);
                  }
                  console.log('Message sent: %s', info.messageId);
                  // Preview only available when sending through an Ethereal account
                  console.log('Preview URL: %s', nodemailer.getTestMessageUrl(info));
        
                  // Message sent: <b658f8ca-6296-ccf4-8306-87d57a0b4321@blurdybloop.com>
                  // Preview URL: https://ethereal.email/message/WaQKMgKddxQDoou...
              });
          }, 1000);
        })
    
    
    })
    
    app.listen(8000, () =>  {
      console.log('ok');
    })
    
    
    

    相关文章

      网友评论

          本文标题:邮件轰炸机

          本文链接:https://www.haomeiwen.com/subject/woarrctx.html