diff options
| author | Odoo's Mergebot <robodoo@odoo.com> | 2020-08-26 09:33:23 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-26 09:33:23 +0200 |
| commit | 474fcb5035794bf2f5dbe1c2019216b1c6399a27 (patch) | |
| tree | 3ba17a829f6a4f02bdbee279245ba82c3303b1c6 /addons | |
| parent | 1940c2371e64b06a6df7a412edf203d7f81838ed (diff) | |
| parent | f0ebeb96a05abc76d2acb77707a79f40e6999375 (diff) | |
[MERGE] base, mail, fetchmail: make mail server configuration more user friendly
PURPOSE
Ease the configuration of external email servers by adding links to the
documentation and by making errors more user friendly.
SPECIFICATIONS
This is done by catching more exceptions when testing incoming and outgoing
mail servers. Some hints are given in the error message.
A link to the documentation is also added in mail: Settings > External Email
Servers feature: add a link to this doc: https://www.odoo.com/documentation/user/13.0/discuss/advanced/email_servers.html
Task ID-22736
PR #54176
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/fetchmail/models/fetchmail.py | 12 | ||||
| -rw-r--r-- | addons/mail/views/res_config_settings_views.xml | 1 |
2 files changed, 12 insertions, 1 deletions
diff --git a/addons/fetchmail/models/fetchmail.py b/addons/fetchmail/models/fetchmail.py index da83677a02c..0850f5e19ee 100644 --- a/addons/fetchmail/models/fetchmail.py +++ b/addons/fetchmail/models/fetchmail.py @@ -3,6 +3,8 @@ import logging import poplib +from ssl import SSLError +from socket import gaierror, timeout from imaplib import IMAP4, IMAP4_SSL from poplib import POP3, POP3_SSL @@ -124,7 +126,15 @@ odoo_mailgate: "|/path/to/odoo-mailgate.py --host=localhost -u %(uid)d -p PASSWO try: connection = server.connect() server.write({'state': 'done'}) - except Exception as err: + except UnicodeError as e: + raise UserError(_("Invalid server name !\n %s", tools.ustr(e))) + except (gaierror, timeout, IMAP4.abort) as e: + raise UserError(_("No response received. Check server information.\n %s", tools.ustr(e))) + except (IMAP4.error, poplib.error_proto) as err: + raise UserError(_("Server replied with following exception:\n %s", tools.ustr(err))) + except SSLError as e: + raise UserError(_("An SSL exception occurred. Check SSL/TLS configuration on server port.\n %s", tools.ustr(e))) + except (OSError, Exception) as err: _logger.info("Failed to connect to %s server %s.", server.server_type, server.name, exc_info=True) raise UserError(_("Connection test failed: %s", tools.ustr(err))) finally: diff --git a/addons/mail/views/res_config_settings_views.xml b/addons/mail/views/res_config_settings_views.xml index 617e3449ce5..4e7e69ccd3d 100644 --- a/addons/mail/views/res_config_settings_views.xml +++ b/addons/mail/views/res_config_settings_views.xml @@ -31,6 +31,7 @@ </div> <div class="o_setting_right_pane"> <label for="external_email_server_default"/> + <a href="https://www.odoo.com/documentation/user/13.0/discuss/advanced/email_servers.html" title="Documentation" class="o_doc_link" target="_blank"></a> <div class="text-muted" id="external_email_server_default"> Configure your own email servers </div> |
