Ensure delete happens even if error

The existing behavior for errors is that if an error occurs, the code to delete the email does not get run. Consequently, an email that's causing an error continues to do so until a human intervenes.

With this patch, the deletion logic is moved up such that if an error occurs, the email is deleted.