[FIX] mail: improve exception management when sending emails
[FIX] mail: improve exception management when sending emails

Commit 00bd7274c406fd8f69aebafcdd41dbc6b5885c96 introduced speed improvements when
sending emails through batching and reusing an SMTP connection for a
given batch.

However exception management was slightly changed during that patch.
Previously to this patch all errors in the sending process were considered
as MailDeliveryException, except for MemoryError and psycopg errors.
However now mail_mail.send() may raise another kind of exception in the
SMTP connect process. Moreover a raise_exception parameter allows to
choose to either raise an exception, or just set emails in exception
state without raising an error. However since the patch it is not taken
into account correctly.

This leads to several issues, notably

 * auth_signup waits for a MailDeliveryException when sending a password
   request email. A badly configured SMTP server leads to a connection
   error that is not caught. This prevents creating users, which could
   be annoying.
 * chatter does not handle exceptions as notification emails are sent
   using raise_exception being False. Having an issue in the connect
   process crashes the chatter.

This commit fixes the exception management so that it behaves like
before the patch.

ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo