Fixed error report sending code placement.

This commit is contained in:
Tristan B. Kildaire 2020-07-20 20:41:48 +02:00
parent 1c43e05e70
commit 2f204f0e83
1 changed files with 25 additions and 24 deletions

View File

@ -675,35 +675,36 @@ public final class ButterflyClient : Thread
}
}
/**
* If there are failed sends then send an error message
* to the sender.
*/
if(failedRecipients.length)
{
/* Create the error message */
JSONValue deliveryReport;
JSONValue[] errorRecipients = [JSONValue(mailbox.username~"@"~server.domain)];
deliveryReport["recipients"] = errorRecipients;
/* TODO: Make more indepth, and have copy of the mail that was tried to be sent */
string errorMessage = "There was an error delivery the mail to: "~to!(string)(recipients)~"\n";
errorMessage ~= "\nThe message was:\n\n"~mailBlock.toPrettyString();
deliveryReport["message"] = errorMessage;
writeln(deliveryReport);
/* Deliver the error message */
sendMail(deliveryReport);
writeln("Mail delivery report sent: "~deliveryReport.toPrettyString());
}
writeln("Sent mail message");
}
writeln("Mail delivered");
/**
* If there are failed sends then send an error message
* to the sender.
*/
if(failedRecipients.length)
{
/* Create the error message */
JSONValue deliveryReport;
JSONValue[] errorRecipients = [JSONValue(mailbox.username~"@"~server.domain)];
deliveryReport["recipients"] = errorRecipients;
/* TODO: Make more indepth, and have copy of the mail that was tried to be sent */
string errorMessage = "There was an error delivery the mail to: "~to!(string)(recipients)~"\n";
errorMessage ~= "\nThe message was:\n\n"~mailBlock.toPrettyString();
deliveryReport["message"] = errorMessage;
writeln(deliveryReport);
/* Deliver the error message */
sendMail(deliveryReport);
writeln("Mail delivery report sent: "~deliveryReport.toPrettyString());
}
/* Store the message in this user's "Sent" folder */
Folder sentFolder = new Folder(mailbox, "Sent");