Node.js实现发送邮件功能
本文实例为大家分享了Android九宫格图片展示的具体代码,供大家参考,具体内容如下
var nodemailer = require("nodemailer"); var mailTitle='http://handsupowo.pl/:Releases HandsUp Info'; var child_process = require('child_process'); var fs= require('fs'); child_process.execFile('phantomjs',['HandsupInfo.js'],function (err, result) { console.log("download over"); }); setTimeout(function() { readFile(); }, 20000); function readFile() { console.log('--------ReadFile--------'); fs.readFile('DownLoadUrl.txt','utf-8',function(err,data){ if(err){ }else{ sendSSLMail(data); } }) } function sendSSLMail(mailContent){ var stransporter = nodemailer.createTransport({ host: '填mailhost', secureConnection: true, // use SSL port: 465, // port auth: { user: 'username', pass: 'userpwd' } }); function ssl(){ var mailOptions = { from: '"2017 New HandsUp Info" <SponsorChecker@intasect.co.jp>', to: '1598828268@qq.com', cc:'hellomusic1993@qq.com', subject: mailTitle, text: mailContent, attachments:[ { filename : 'HandsupInfo.png', path: 'HandsupInfo.png' }, { filename : 'HandsupInfo.html', path: 'HandsupInfo.html' },{ filename : 'DownLoadUrl.txt', path: 'DownLoadUrl.txt' } ] } return mailOptions; } stransporter.sendMail(ssl(), function(error, info){ if(error){ console.log(error); }else{ console.log('Message sent: ' + info.response); } }); }
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持积木网。
nodejs中art-template模板语法的引入及冲突解决方案
使用Webstorm创建nodejsexpress应用时,默认使用的是jade或者ejs模板,对于不习惯这两种模板语法的人来说确实不是很方便。没关系,这里我们使用art-template
mongoose设置unique不生效问题的解决及如何移除unique的限制
前言unique属于schema约束验证中的一员,他的作用主要就是让某一个字段的值具有唯一性(不能重复)保持字段的唯一性使用type值:{type:String,unique:true,dro
mac中利用NVM管理不同node版本的方法详解
前言大家在开始本文的正文之前,建议大家先看看这篇文章:http://www.gimoo.net/article/73424.htm,这篇文章给大家详细介绍了关于node.js下使用nvm或者n来进行
编辑:568数据
标签:本文,模板,这篇文章,字段,前言