Node.js实现发送邮件功能
程序员文章站
2022-04-28 23:24:13
本文实例为大家分享了android九宫格图片展示的具体代码,供大家参考,具体内容如下
var nodemailer = require("nodemailer")...
本文实例为大家分享了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); } }); }
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。