Properly handle mail exceptions
Exceptions can still happen when sending mail, e.g. when we reach a limit and get blocked by the mail server.
This is an issue if we send a list of emails and then update the database in a final step. If send_mail()
crashes somewhere in the list, the first few mails have already been send, but the database is never updated to reflect that.
This was fixed for mail recruitment in !2217 (merged). There are many other cases though that need a similar fix.