node.js - Running bulk email with nodemailer in Meteor js application -


i trying use nodemailer in application. after following thread here is possible to send bulk pre-rendered email via sendgrid api?. kept on getting below error suggested version problem. stated on nodemailer page version 6- upward required, , presently i'm running on version 7.4.0, , still getting error. i'm thinking, don't know do. please what's way out? thanks.

this implementation: var nodemailer = require("nodemailer");

if (meteor.isserver) {     meteor.methods({         massmail: function () {             var smtptransport = nodemailer.createtransport("smtp",{                 service: "gmail",                 auth: {                     user: "mygmailaccount@gmail.com",                     pass: "mygmailpassword"                 }             });              var collections = collectionname.find({userid: this.userid});            // var users = getallusersasarray();              // loop through users             collections.foreach(function (collection){                  // setup message                 var mailoptions = {                     from: "no-reply@christdoes.com",                     to: students.useremail,                     subject: subjecttemplate.render(collection),                     text: texttemplate.render(collection),                     html: htmltemplate.render(collection)                 }                  // send mail                 smtptransport.sendmail(mailoptions, function(error, response){                     if(error){                         console.log(error);                     }else{                         console.log("message sent: " + response.message);                     }                 });              });         }     }); } 

this error on console

w20170818-10:42:01.023(1)? (stderr) c:\programs\contract\schoolapps\node_modules\nodemailer\lib\mailer\index.js:31 w20170818-10:42:01.024(1)? (stderr)             compile: [(...args) => this._convertdataimages(...args)], w20170818-10:42:01.025(1)? (stderr)                        ^^^ w20170818-10:42:01.034(1)? (stderr) w20170818-10:42:01.040(1)? (stderr) syntaxerror: unexpected token ... w20170818-10:42:01.041(1)? (stderr)     @ exports.runinthiscontext (vm.js:53:16) w20170818-10:42:01.043(1)? (stderr)     @ module._compile (module.js:373:25) w20170818-10:42:01.044(1)? (stderr)     @ object.module._extensions..js (module.js:416:10) w20170818-10:42:01.046(1)? (stderr)     @ module.load (module.js:343:32) w20170818-10:42:01.047(1)? (stderr)     @ function.module._load (module.js:300:12) w20170818-10:42:01.049(1)? (stderr)     @ module.require (module.js:353:17) w20170818-10:42:01.051(1)? (stderr)     @ require (internal/module.js:12:17) w20170818-10:42:01.053(1)? (stderr)     @ object.<anonymous> (c:\programs\contract\schoolapps\node_modules\nodemailer\lib\nodemailer.js:3:16) w20170818-10:42:01.059(1)? (stderr)     @ module._compile (module.js:409:26) w20170818-10:42:01.061(1)? (stderr)     @ object.module._extensions..js (module.js:416:10 

you can't update node used in meteor, solution install babel transpiler:

meteor npm install --save babel-runtime 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -