yashxx07 commited on
Commit
e683ab5
1 Parent(s): d3c675b

Update emails.js

Browse files
Files changed (1) hide show
  1. emails.js +3 -3
emails.js CHANGED
@@ -211,12 +211,12 @@ async function sendEmail(req, res) {
211
  emailsList.forEach(async (user) => {
212
 
213
  const mailTemplate = craftEmailTemplate(user, newsList);
214
- res.send(mailTemplate);
215
- //await sendToUser(user.email, mailTemplate);
216
 
217
  });
218
  //const result = await sendEmail();
219
- //res.send({ "news": newsList, "emails": emailsList });
220
  } catch (error) {
221
  console.log(error);
222
  res.status(500).send("Error sending email.");
 
211
  emailsList.forEach(async (user) => {
212
 
213
  const mailTemplate = craftEmailTemplate(user, newsList);
214
+ //res.send(mailTemplate);
215
+ await sendToUser(user.email, mailTemplate);
216
 
217
  });
218
  //const result = await sendEmail();
219
+ res.send({ "news": newsList, "emails": emailsList });
220
  } catch (error) {
221
  console.log(error);
222
  res.status(500).send("Error sending email.");