* modified sendMail function to queue mails instead of immediately sending them

* fixed a small bug that caused an error message due to an undefined mail queue array
This commit is contained in:
Tobi Schäfer 2003-10-07 16:12:47 +00:00
parent a76698be3e
commit 86061433f4

View file

@ -567,9 +567,7 @@ function sendMail(from, to, subject, body) {
break;
}
// finally send the mail
mail.send();
if (mail.status != 0)
throw new MailException("mailSend");
mail.queue();
return new Message("mailSend");
}
@ -592,9 +590,15 @@ Mail.prototype.queue = function() {
* application-wide mail queue
*/
function flushMailQueue() {
if (!app.data.mailqueue)
return;
while (app.data.mailqueue.length) {
var result = app.data.mailqueue.pop().send();
app.debug("Mail transfer status: " + result);
var mail = app.data.mailqueue.pop();
mail.send();
if (mail.status > 0) {
app.debug("Mail transfer status: " + mail.status);
//throw new MailException("mailSend");
}
}
return;
}