mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-04-23 03:45:45 -04:00
Fixed SendGrid support.
This commit is contained in:
parent
a885664a41
commit
aa01c671a9
17
meshmail.js
17
meshmail.js
@ -342,9 +342,26 @@ module.exports.CreateMeshMail = function (parent) {
|
|||||||
obj.sendGridServer
|
obj.sendGridServer
|
||||||
.send(mailToSend)
|
.send(mailToSend)
|
||||||
.then(function () {
|
.then(function () {
|
||||||
|
obj.sendingMail = false;
|
||||||
parent.debug('email', 'SendGrid sending success.');
|
parent.debug('email', 'SendGrid sending success.');
|
||||||
|
obj.pendingMails.shift();
|
||||||
|
obj.retry = 0;
|
||||||
|
sendNextMail();
|
||||||
}, function (error) {
|
}, function (error) {
|
||||||
|
obj.sendingMail = false;
|
||||||
parent.debug('email', 'SendGrid sending error: ' + JSON.stringify(error));
|
parent.debug('email', 'SendGrid sending error: ' + JSON.stringify(error));
|
||||||
|
obj.retry++;
|
||||||
|
// Wait and try again
|
||||||
|
if (obj.retry < 3) {
|
||||||
|
setTimeout(sendNextMail, 10000);
|
||||||
|
} else {
|
||||||
|
// Failed, send the next mail
|
||||||
|
parent.debug('email', 'SendGrid server failed (Skipping): ' + JSON.stringify(err));
|
||||||
|
console.log('SendGrid server failed (Skipping): ' + JSON.stringify(err));
|
||||||
|
obj.pendingMails.shift();
|
||||||
|
obj.retry = 0;
|
||||||
|
sendNextMail();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else if (obj.smtpServer != null) {
|
} else if (obj.smtpServer != null) {
|
||||||
// SMTP send
|
// SMTP send
|
||||||
|
Loading…
x
Reference in New Issue
Block a user