Skip to content

Commit

Permalink
Merge pull request #196 from konecty/fix/send-email
Browse files Browse the repository at this point in the history
Fix: konecty send email
  • Loading branch information
CaduGomes authored Dec 17, 2024
2 parents 91cc685 + 1ec66a7 commit 2bf5e24
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/imports/mailConsumer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ async function sendEmail(record) {
if (process.env.KONECTY_MODE !== 'production') {
mail.subject = `[DEV] [${mail.to}] ${mail.subject}`;
// mail.to = null; // '[email protected]'
mail.to = 'derotino.silveira@konecty.com';
mail.to = 'support@konecty.com';
mail.cc = null;
mail.bcc = null;
}
Expand All @@ -118,7 +118,7 @@ async function sendEmail(record) {
logger.info(`📧 Email sent to ${response.accepted.join(', ')} via [${serverHost || record.server}]`);
}
} catch (err) {
logger.error(err, `📧 Email error: ${err.message}`);
logger.error(`📧 Email error: ${err.message}`);
err.host = serverHost || record.server;
await MetaObject.Collections['Message'].updateOne({ _id: record._id }, { $set: { status: 'Falha no Envio', error: err } });

Expand Down Expand Up @@ -199,11 +199,11 @@ async function consume() {
await BluebirdPromise.each(range(0, mailCount), async () => {
const updatedRecords = await MetaObject.Collections['Message'].findOneAndUpdate(query, update, options);

if (updatedRecords == null || updatedRecords.value == null) {
if (updatedRecords == null || updatedRecords._id == null) {
return;
}

return send(updatedRecords.value);
return send(updatedRecords);
});

return consumeCronJob.start();
Expand Down

0 comments on commit 2bf5e24

Please sign in to comment.