[IMP] mail: avoid sending an email twice
In some specific conditions (e.g. admin logging during cron run, concurrent update), writing on the mail object may fail, triggering a rollback of the transaction. As the write was done after the SMTP sendmail action, an email could be sent twice (state not correctly put, would be retried at next process of the email queue). This patch provoke the error before the sendmail action and thus avoids sending the email. Fixes #552
Please register or sign in to comment