Hi,
I am attempting to configure our corporate email domain, and ran into an issue configuring the inbound server. Basically I cannot configure the IMAP server - same hostname, port and credentials work fine on different email clients we tried.
The only way I was able to configure inbound email is by using POP without SSL, and in this scenario the received emails are removed from the email server, which is not acceptable for us and I do not see any means of changing this behavior from the ERP.
I am using:
ERPNext: v12.6.0 (version-12)
Frappe Framework: v12.4.1 (version-12)
The error shown in the logs when attempting IMAP wSSL is the following:
> [ERROR] 2020-04-25 16:31:11,882 | /home/frappe/frappe-bench/apps/frappe/frappe/app.py:
> Site: erp.mydomain.com
> Form Dict: {
> "action": "Save",
> "cmd": "frappe.desk.form.save.savedocs",
> "doc": "{\"name\":\"mydomain.com\",\"owner\":\"Administrator\",\"creation\":\"2020-04-10 13:06:15.743939\",\"modified\":\"2020-04-24 20:37:46.451213\",\"modified_by\":\"Administrator\",\"idx\":0,\"docstatus\":0,\"domain_name\":\"mydomain.com\",\"email_id\":\"erp@mydomain.com\",\"email_server\":\"server.emailprovider.com\",\"use_imap\":1,\"use_ssl\":1,\"incoming_port\":\"\",\"attachment_limit\":10,\"smtp_server\":\"server.emailprovider.com\",\"use_tls\":1,\"smtp_port\":\"587\",\"doctype\":\"Email Domain\",\"__last_sync_on\":\"2020-04-25T16:11:24.452Z\",\"__unsaved\":1}"
> }
> Request Error
> Traceback (most recent call last):
> File "/home/frappe/frappe-bench/apps/frappe/frappe/email/doctype/email_domain/email_domain.py", line 76, in on_update
> email_account.save()
> File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 273, in save
> return self._save(*args, **kwargs)
> File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 309, in _save
> self.run_before_save_methods()
> File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 895, in run_before_save_methods
> self.run_method("validate")
> File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 794, in run_method
> out = Document.hook(fn)(self, *args, **kwargs)
> File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1065, in composer
> return composed(self, method, *args, **kwargs)
> File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1048, in runner
> add_to_return_value(self, fn(self, *args, **kwargs))
> File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 788, in <lambda>
> fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
> File "/home/frappe/frappe-bench/apps/frappe/frappe/email/doctype/email_account/email_account.py", line 68, in validate
> self.get_incoming_server()
> File "/home/frappe/frappe-bench/apps/frappe/frappe/email/doctype/email_account/email_account.py", line 168, in get_incoming_server
> email_server.connect()
> File "/home/frappe/frappe-bench/apps/frappe/frappe/email/receive.py", line 43, in connect
> return self.connect_imap()
> File "/home/frappe/frappe-bench/apps/frappe/frappe/email/receive.py", line 51, in connect_imap
> self.imap = Timed_IMAP4_SSL(self.settings.host, self.settings.incoming_port, timeout=frappe.conf.get("pop_timeout"))
> File "/home/frappe/frappe-bench/apps/frappe/frappe/email/receive.py", line 564, in __init__
> self._super.__init__(self, *args, **kwargs)
> File "/usr/lib/python3.6/imaplib.py", line 1288, in __init__
> IMAP4.__init__(self, host, port)
> File "/usr/lib/python3.6/imaplib.py", line 198, in __init__
> self.open(host, port)
> File "/usr/lib/python3.6/imaplib.py", line 1301, in open
> IMAP4.open(self, host, port)
> File "/usr/lib/python3.6/imaplib.py", line 299, in open
> self.sock = self._create_socket()
> File "/usr/lib/python3.6/imaplib.py", line 1293, in _create_socket
> server_hostname=self.host)
> File "/usr/lib/python3.6/ssl.py", line 407, in wrap_socket
> _context=self, _session=session)
> File "/usr/lib/python3.6/ssl.py", line 817, in __init__
> self.do_handshake()
> File "/usr/lib/python3.6/ssl.py", line 1077, in do_handshake
> self._sslobj.do_handshake()
> File "/usr/lib/python3.6/ssl.py", line 689, in do_handshake
> self._sslobj.do_handshake()
> ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:852)