Fixed bad/malformed request error when Sent was over quota. This was checked at the second stage when appending to Sent but not the first stage (the response was simply thrown away). I've abstracted the checking to a separate function that is called at the two relevant points. Closes: #1172694