-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #196 from konecty/fix/send-email
Fix: konecty send email
- Loading branch information
Showing
1 changed file
with
4 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
} | ||
|
@@ -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 } }); | ||
|
||
|
@@ -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(); | ||
|