So I am building this small emailing application to study node.js and mysql.
I have successfully stored data to mySQL database and I stored it like this
var emails = 'SELECT user_email FROM scrap';
con.query(emails, function(err, email, fields){
//console.log(email);
});
The console.log shows
[ RowDataPacket { user_email: 'dummybot@gmail.com' },
RowDataPacket { user_email: 'dummybot2@gmail.com' }, ]
I am currently using nodemailer to send multiple emails at once.
var mailOptions = {
from: 'dummybot@gmail.com',
to: emails,
subject: 'Sending Email using Node.js[nodemailer]',
text: 'That was easy!'
};
When I execute this command I receive an error
Error: No recipients defined
Is there an alternative way to send multiple emails at once? or is there a way for me to make sure my application send multiple emails accordingly to the emails from database(mySQL). I would like to make sure the app sends reply to all emails stored in the database.