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

  • 相关阅读:
    FastAPI框架
    bitmap去重与布隆过滤器
    MongoDB
    分布式爬虫
    scrapy 请求传参
    Scrapy 对接selenium
    Scrapy 去重源码分析
    [Python]网络小说爬取、爬虫
    学习进度报告【第八周】
    [opencv]图像处理-边缘检测
  • 原文地址:https://www.cnblogs.com/luguiqing/p/8320517.html
Copyright © 2011-2022 走看看