精华内容
下载资源
问答
  • NodeMailer

    2019-05-28 11:20:00
    刚开始学习MEAN, 搞个插件发个邮件。 NodeMailer貌似出镜率很高,用用。 https://nodemailer.com/smtp/ ... const nodeMailer = require('nodemailer'); let transporterExt = nodeMa...

    刚开始学习MEAN, 搞个插件发个邮件。

    NodeMailer貌似出镜率很高,用用。

    https://nodemailer.com/smtp/ 


    先申请了个个人的Outlook的邮箱,测试了一把,顺利通过。耶,好激动。

        const nodeMailer = require('nodemailer');

    let transporterExt = nodeMailer.createTransport({ host: 'smtp-mail.outlook.com', port: 587, secureConnection: false, auth: { user: 'messagesender@outlook.com', pass: 'jiubugaosuni', }, tls: { ciphers: 'SSLv3' } });
      
      let mailOptions = {
            from: '"DisplayName"<real_address@xxx.com>',
            to: '' + emailList,
            subject: '' + subject,
            text: '' + text,
            html: '<p><h1>' + text + '</h1></p>'
        };

      transporterExt.
    transporter.sendMail(mailOptions, (error, info) => {
            if (error) {
                res.send({ hasError: true, msg: 'Failed to send mail.' + error.message });
                return console.log('mail error', error);
            }
            console.log('Message %s sent: %s', info.messageId, info.response);
            res.send({ hasError: false, msg: 'Mail Sent.' });
     
        });
     

    然后呢,试了几天以后,发现突然授权失败了,用网页一登陆outlook,发现被封号了,需要输入手机验证码登陆。

    原来outlook不喜欢我这么发邮件,可能被认为成垃圾邮件的制造者了。

    而且,感觉我的目的邮箱自从接收到outlook的邮件后,也确认莫名接收到过outlook垃圾邮件。

    不管了,此路不通,换一条。


    后来我就想,整个公司内部的邮箱吧,看着也正式一点。

    于是参考了同事C#的代码。

                MailMessage mail = new MailMessage();
    
                mail.Subject = "AUTO TEST of Sending Emails";
                mail.From = new MailAddress("地址随便写@域名.com", "显示名称随便写");
    mail.To.Add("确实存在的目的邮箱地址"); mail.Body = "Testing Email"; mail.BodyEncoding = Encoding.UTF8; mail.IsBodyHtml = true; SmtpClient client = new SmtpClient(); client.Host = "smtp.公司内网域名.com"; client.Port = 25; client.Send(mail);

    我去,居然连用户名密码都不用给,发送邮件的邮箱地址和名称可以随便写,不管存在与否,太爽啦。

    经过反复尝试之后,下面的代码可以工作,太好啦。

        let transporter = nodeMailer.createTransport({
    
            host: 'smtp.公司内网域名.com',
            port: 25,
            tls: {
                //This config would open a connection to TLS server with self-signed or invalid TLS certificate
                rejectUnauthorized: false
            }
        });

    毕竟是内网嘛,先不考虑安全性,完事儿,收工。

     

    参考文献:

    https://stackoverflow.com/questions/47595691/send-email-without-password-using-nodemailer-over-a-zimbra-smtp#

     

    转载于:https://www.cnblogs.com/jiceberg420/p/10936083.html

    展开全文
  • nodemailer

    2018-07-30 07:07:50
    var nodemailer=require("nodemailer");var nodemailer=require("nodemailer");var config={host:"smtp.163.com",port:465,auth:{user:"aaaaa@163.com",pass:"aaaa!&...

    
    
    var nodemailer=require("nodemailer");var nodemailer=require("nodemailer");var config={host:"smtp.163.com",port:465,auth:{user:"aaaaa@163.com",pass:"aaaa!"}}var transporter=nodemailer.createTransport(config);
    function sendMail(receiver){var data={from:config.auth.user,to:receiver,subject:"this is a test",html:"<h1>this is a test from nodemailer</h1><p>this is using node to send mail</p>"};transporter.sendMail(data,function(error,info){if(error){console.log(error)}else{cosnole.log(info.response)}})}sendMail(["768838557@qq.com","power998@163.com"])复制代码

    npm强大的资源,几行代码就能搞定发送邮件;

    结果如下:


    当然,详细配置还要去看官方api,地址如下

    https://www.npmjs.com/package/nodemailer


    展开全文
  • Nodemailer

    2017-12-28 17:16:00
    nodemailer官方定义:nodemailer是node.js的一个应用程序,用来发送邮件。 第一步安装 npm install nodemailer --save 第二部参照官方模板  'use strict'; const nodemailer = require('nodemailer...

    项目中用到的小功能,感觉很实用,随便记下来。

    nodemailer官方定义:nodemailer是node.js的一个应用程序,用来发送邮件。

    第一步安装

    npm install nodemailer --save

    第二部参照官方模板 

    'use strict';
    const nodemailer = require('nodemailer');
    
    // Generate test SMTP service account from ethereal.email
    // Only needed if you don't have a real mail account for testing
    nodemailer.createTestAccount((err, account) => {
    
        // create reusable transporter object using the default SMTP transport
        let transporter = nodemailer.createTransport({
            host: 'smtp.ethereal.email',
            port: 587,
            secure: false, // true for 465, false for other ports
            auth: {
                user: account.user, // generated ethereal user
                pass: account.pass  // generated ethereal password
            }
        });
    
        // setup email data with unicode symbols
        let mailOptions = {
            from: '"Fred Foo ?" <foo@blurdybloop.com>', // sender address
            to: 'bar@blurdybloop.com, baz@blurdybloop.com', // list of receivers
            subject: 'Hello ✔', // Subject line
            text: 'Hello world?', // plain text body
            html: '<b>Hello world?</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...
        });
    });
    

    查看Nodemailer官方请点击

    最后分析整理模板如下:

    成功发送邮件!

    var mailTransport = nodemailer.createTransport({
      host: '100.100.11.11',
      secure: false, // 使用SSL方式(安全方式,防止被窃取信息)
      port: 587,
      auth: {
        user: '**@**.com',
        pass: '******'
      },
      tls: {
        //是否忽略认证书
        rejectUnauthorized: false
      }
    });
    
    
    //express框架获取数据
    apiRoutes.all('/', function (req, res, next) {
    
      var data = req.query;
      var options = {
        from: '"发送人" < **@**.com >',
        to: '"接收人" < **@***.com >',
        // cc          : ''    //抄送
        // bcc         : ''    //密送
        subject: '一封关于'+data.name+'的邮件',
        text: '一封来自Node Mailer的邮件',
        html: '<h1>新春送'+data.id+'福利!</h1><img src="cid:001"/>',
        attachments: [{
          filename: 'pic.png', // 改成你的附件名
          path: 'src/style/images/pic.png', // 改成你的附件路径
          cid: '001' // cid可被邮件使用
        }]
      };
    
      mailTransport.sendMail(options, function (err, msg) {
        if (err) {
          console.log(err);
          res.render('home', {'title': err});
        } else {
          console.log(msg);
          res.render('home', {'title': "已接收:" + msg.accepted});
          res.send({'msg':'Done! sendMail success!'});
          res.redirect('./');
        }
      });
    
    });
    

     

    转载于:https://my.oschina.net/yezijun/blog/1596235

    展开全文
  • Error nodemailer

    2020-12-26 14:12:33
    at SMTPConnection._onError (/var/www/html/<strong><em>*</em></strong><strong><em>*</em></strong><strong><em>*</em></strong><em>/node_modules/nodemailer/lib/smtp-connection/index.js:774:14) ...
  • node nodemailer

    2019-03-25 14:04:12
    参考https://nodemailer.com/about/ 安装 npm install nodemailer --save sendEmail.js ...const nodemailer = require('nodemailer'); const config = { email:{ host: 'smtp.exmail.qq.com', ...

    参考 https://nodemailer.com/about/

    安装 

    npm install nodemailer --save

    sendEmail.js

    const nodemailer = require('nodemailer');
    const config = {
        email:{
            host: 'smtp.exmail.qq.com',
            port: 465,
            secure: true,
            user: 'example@qq.com',
            pass: 'UZNmJxTgbekA949o',
            from: 'example@qq.com',
            subject: '您的密码重置完成',
        },
    };
    
    async function sendEmail(address,passwordInfo) {
        let account = await nodemailer.createTestAccount();
        console.log('Credentials obtained, sending message...');
        // Create a SMTP transporter object
        let transporter = nodemailer.createTransport(
            {
                host: config.email.host,
                port: config.email.port,
                secure: config.email.secure,
                auth: {
                    user: config.email.user,
                    pass: config.email.pass
                },
                logger: false,
                debug: false
            },
            {
                from: config.email.from,
            }
        );
    
        let info = await transporter.sendMail(
            {
                to: address,
                subject: config.email.subject,
                text: `新密码为:${passwordInfo}`,
                html: ''
            }
        );
        console.log('Message sent successfully!');
        console.log('Server responded with "%s"', info.response);
        transporter.close();
    }
    
    module.exports = sendEmail;

    调用

    const SendEmail= require("./SendEmail");
    //
    SendEmail("123456@qq.com", 123456);

     

    展开全文
  • mongodb nodemailer

    2018-11-17 14:15:00
    npm i --save nodemailer var nodemailer = require("nodemailer"); app.get("/sendEmail",function(req,res){ var mailTrans = nodemailer.createTransport({ service:'Gmail', auth:{ ...
  • nodemailer-example-源码

    2021-03-16 12:36:20
    nodemailer-示例
  • nodemailer-simple-源码

    2021-03-09 06:09:22
    nodemailer-simple
  • nodemailer模块

    2018-01-20 13:16:00
    1 var nodemailer = require('nodemailer'); 2 var transporter = nodemailer.createTransport({ 3 //https://github.com/andris9/nodemailer-wellknown#supported-services 支持列表 4 service: ...
  • nodemailer-amqp-example, 将Nodemailer与RabbitMQ一起使用的示例 Nodemailer示例 这是一个使用 RabbitMQ ( amqplib ) 作为队列 Nodemailer电子邮件消息的示例。 这允许你快速从应用程序推
  • nodemailer 简介

    2019-03-30 13:11:53
    Nodemailer 是 Node.js 应用程序的一个模块,可以方便地发送电子邮件。 该项目于 2010 年开始,至今已经相当稳定,这也是如今大多数 Node.js 用户默认情况下发送邮件的解决方案。 使用 # 初始化 pageage.json ...
  • nodemailer使用记录

    2021-02-23 10:00:46
    const nodemailer = require("nodemailer"); //创建发送邮件的对象 //nodemodules/nodemailer/well-know/service.josn //邮箱服务器信息 let transporter = nodemailer.createTransport({ host: "smtp.qq.com", ...
  • nodemailer-mailgun-transport 这是什么? nodemailer是一个了不起的节点模块,可以在任何nodejs应用程序中发送电子邮件。 这是运输的插件,与nodemailer去用发送电子邮件的迷死人! 战俘 它是如何工作的? 基于和...
  • nodejs nodemailer 使用

    2019-09-22 15:10:50
    index.js const nodemailer=require("nodemailer") let sendEmail=function () { var transporter = nodemailer.createTransport({ host: "smtp.qq.com", port: 465, sec...
  • Send-Email-Nodemailer-源码

    2021-03-17 08:20:06
    Send-Email-Nodemailer
  • 一、安装 nodemailer 代码如下:npm install nodemailer –save二、调用 代码如下:var nodemailer = require(“nodemailer”); // 开启一个 SMTP 连接池var smtpTransport = nodemailer.createTransport(“SMTP”,{ ...
  • nodeMailer发送邮箱验证码 1、封装nodemailer对象 const nodemailer = require("nodemailer"); // 封装nodemailer对象 let nodeEmail = { config: { host: "smtp.qq.com", port: 587, secure: false, //...
  • Fails with nodemailer 0.2.0

    2020-12-28 07:08:43
    <div><p>SMTPClient is removed from nodemailer 0.2.0, causing havoc.</p><p>该提问来源于开源项目:Marak/node_mailer</p></div>
  • nodemailer简易邮件发送

    2020-02-27 01:32:22
    使用到了node.js的一个第三方模块nodemailer , 相关文档和api可在https://nodemailer.com/about/查看 。... const nodemailer = require('nodemailer'); let transporter = nodemailer.createTr...
  • nodemailer使用Prerequisite: 先决条件: How to send emails using Nodemailer | Node.js 如何使用Nodemailer发送电子邮件。 Node.js How to send emails with attachments using Nodemailer | Node.js 如何...
  • Nodemailer是一个简单易用的Node.js邮件发送组件,具体操作如下 1、安装nodemailer npm install nodemailer --save 2、特点 Nodemailer的主要特点包括: 支持Unicode编码 支持Window系统环境 支持HTML内容和...
  • Upgrade Nodemailer to 1.0

    2020-12-09 05:43:01
    <div><p>http://www.andrisreinman.com/nodemailer-v1-0/#migrationguide</p> <p>Tests are currently broken, we'll have to freeze the version to pre-1.0 until this is resolved.</p><p>该提问来源于开源...
  • 节点邮件 简单的NodeMailer应用 Proueecto de prueba usando NodeMailer和Express
  • <div><p>Right now the way nodemailer sends email isn't compatible with sendgrid. Expectations are described here: https://sendgrid.com/docs/for-developers/sending-email/getting-started-smtp/</p> ...
  • nodemailer邮件服务配置

    2020-12-14 20:08:50
    nodemailer邮件服务配置 前言 最近刚学的邮件服务配置,其实我只知道如何配置。如果有不对的还请指正 一、nodemailer是什么? Nodemailer is a module for Node.js applications to allow easy as cake email ...
  • nodemailer 发邮件

    2019-10-08 01:07:00
    var transporter = nodemailer.createTransport({//v1.0 above do not use 'SMTP' as first param host: "smtp.xxx.xxx.com", port: 25, name:"xx.xx.com", ...
  • nodemailer使用问题

    2019-09-28 14:32:07
    使用nodemailer发送邮件,一直没收到邮件, 后来打印出error的信息,发现是返回报错码501 await transporter.sendMail(mailOptions, (error, info) => { global.console.log(code, error, info) if (error)...
  • 使用nodemailer发邮件

    2020-02-16 17:21:03
    const nodemailer = require('nodemailer') let transporter = nodemailer.createTransport({ host: 'smtp.qq.com', secureConnection: true, // use SSL port: 465, secure: true, // true port 465, false...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 918
精华内容 367
关键字:

nodemailer