好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

nodemailer

nodemailer 介绍

Nodemailer可以帮助我们 快速 实现 发送邮件 的 功能 。

Nodemailer特点:

支持 Unicode编码

支持 Window系统环境

支持 html 内容 和普通文本 内容

支持 附件(传送大附件)

支持 html 内容 中嵌入 图片

支持 SSL/STARTTLS安全的 邮件 发送

支持 内置的transport 方法 和其他 插件 实现的transport 方法

支持 自定义 插件 处理消息

支持 XOAUTH2 登录 验证

Nodemaile安装使用

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...

});

});

网站地址 : http://nodemailer.com/

GitHub: https://github.com/nodemailer/nodemailer

网站描述: 一个 简单易用的Node.js 邮件 发送组件

nodemailer官方网站

官方网站: http://nodemailer.com/

如果觉得 网站内容还不错,欢迎将 网站 推荐给程序员好友。

查看更多关于nodemailer的详细内容...

  阅读:36次

上一篇

下一篇

第1节:consolidate.js    第2节:node-crawler    第3节:nodemon    第4节:Agenda    第5节:axios    第6节:rxdb    第7节:node-mongodb-native    第8节:Koa    第9节:Nodal.js    第10节:synaptic    第11节:Lass.js    第12节:node-postgres【pg】    第13节:nlp.js    第14节:bluebird    第15节:Feathers.js    第16节:Cheerio.js    第17节:Roarr    第18节:Kue    第19节:Mean.js    第20节:SuperAgent    第21节:Nest.js    第22节:pandora    第23节:node-opencv    第24节:nodemailer    第25节:jsdom    第26节:foy    第27节:node-cron    第28节:loopback    第29节:mongoose    第30节:Connect    第31节:node-orm2    第32节:DropIt    第33节:JSON-Server    第34节:Derby.js    第35节:yargs    第36节:node    第37节:node-formidable    第38节:Deno    第39节:sharp    第40节:nock    第41节:SocketCluster    第42节:nvm    第43节:node-clinic    第44节:node-xml2js    第45节:Express    第46节:vm2    第47节:node-red    第48节:pm2    第49节:Notif.me    第50节:Kraken.js    第51节:x-ray    第52节:GraphQL Server    第53节:Primus    第54节:lowdb    第55节:Restify.js    第56节:ora    第57节:socketstream    第58节:carlo    第59节:Mean.IO    第60节:knex.js    第61节:Horizon    第62节:avn    第63节:node-schedule    第64节:Mojito    第65节:ncc    第66节:lyo    第67节:mongous    第68节:ViralJS    第69节:Q.js    第70节:svgo    第71节:gnvm    第72节:Spine.js    第73节:Hapi.js    第74节:async    第75节:Fastify    第76节:rebridge    第77节:debug    第78节:Sails.js    第79节:node_redis    第80节:moleculer    第81节:chalk    第82节:colors.js    第83节:NeDB    第84节:RobotJs    第85节:Inquirer.js    第86节:commander.js    第87节:svg-captcha    第88节:awesome-nodejs    第89节:Node-SpliderApi    第90节:opencv4nodejs    第91节:GitBook    第92节:actionHero.js    第93节:Electrode    第94节:Egg.js    第95节:FlexSearch.js    第96节:passport.js    第97节:nodebestpractices    第98节:nodejieba    第99节:css-colorguard    第100节:istanbul    第101节:Sequelize    第102节:flatiron.js