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

  • 相关阅读:
    Oracle数据库安装
    [转]卡西欧手表调日期正确方法
    python密码处理(可用于生产模式)
    [转]python对json的相关操作
    [转]Python中的with…as…
    Python标准库--os模块
    我的github代码添加
    Python正则表达式+自创口诀
    自己总结python用xlrdxlwt读写excel
    CentOS安装+配置+远程
  • 原文地址:https://www.cnblogs.com/luguiqing/p/8320517.html
Copyright © 2011-2022 走看看