zoukankan      html  css  js  c++  java
  • nodemailer模块

     1 var nodemailer = require('nodemailer');
     2 var transporter = nodemailer.createTransport({
     3     //https://github.com/andris9/nodemailer-wellknown#supported-services 支持列表
     4     service: 'qq',
     5     port: 465, // SMTP 端口
     6     secureConnection: true, // 使用 SSL
     7     auth: {
     8         user: '1466594176@qq.com',
     9         //这里密码不是qq密码,是你设置的smtp密码
    10         pass: ''
    11     }
    12 });

    在qq邮箱中点击 “”“设置” =》“账号”

    然后就可以发送邮件了

     1 var mailOptions = {
     2     from: '@qq.com', // 发件地址
     3     to: '@qq.com', // 收件列表
     4     subject: '查成绩啦', // 标题
     5     //text和html两者只支持一种
     6     text: '查成绩啦', // 标题
     7     html: '<b>good luck for myself!</b>' // html 内容
     8 };
     9 
    10 // send mail with defined transport object
    11 transporter.sendMail(mailOptions, function(error, info) {
    12     if (error) {
    13         return console.log(error);
    14     }
    15     console.log('Message sent: ' + info.response);
    16 
    17 });

    其中有哪些邮件可以直接调用,可以查看对于的文档(https://nodemailer.com/smtp/well-known/)

    附上查询成绩的js脚本 https://github.com/luguiqing/nodemailer

    参考资料 https://www.cnblogs.com/pingfan1990/p/4864822.html

  • 相关阅读:
    POJ 3126 Prime Path
    POJ 2429 GCD & LCM Inverse
    POJ 2395 Out of Hay
    【Codeforces 105D】 Bag of mice
    【POJ 3071】 Football
    【POJ 2096】 Collecting Bugs
    【CQOI 2009】 余数之和
    【Codeforces 258E】 Devu and Flowers
    【SDOI 2010】 古代猪文
    【BZOJ 2982】 combination
  • 原文地址:https://www.cnblogs.com/luguiqing/p/8320517.html
Copyright © 2011-2022 走看看