Getting a following error:
Title:
receive.connect_pop
Error:
Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/email/receive.py”, line 74, in connect_pop
self.pop = Timed_POP3(self.settings.host, timeout=frappe.conf.get(“pop_timeout”))
File “/home/frappe/frappe-bench/apps/frappe/frappe/email/receive.py”, line 550, in init
self._super.init(self, *args, **kwargs)
File “/usr/lib/python2.7/poplib.py”, line 89, in init
self.sock = socket.create_connection((host, port), timeout)
File “/usr/lib/python2.7/socket.py”, line 553, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
gaierror: [Errno -2] Name or service not known
ENV:
- ERPNext: v10.1.42 (master)
- Frappe Framework: v10.1.39 (master)
- Python 2
Tried to connect to said server using telnet from same machine on 110 port (default) no problem whatsoever.
Tried to run following code (wich is similar to what erp uses ) on the same machine - no indication of any problem.
import poplib
M = poplib.POP3('pop3.domain.com')
M.user('login')
M.pass_('password')
numMessages = len(M.list()[1])
for i in range(numMessages):
for j in M.retr(i+1)[1]:
print (j)
(Even tried to run script using frappe/frappe-bench/env/bin/python2.7
, same result)
Anyone has a similar experience?
Similar but somewhat old post.
Sounds like somewhere you either have a typo in your hostname address for the pop server or incorrect port.
Otherwise it’s always worth looking at whether you have an issue with firewalling unexpectedly blocking a port.
Did this work to start with and suddenly stop or is it a new install? I would be surprised if it’s an issue with an update by ERPNext as they rarely touch the email parsing code. Although I use IMAP and not POP as I suspect more people may also do.
Well, I never tried to use pop3 before. Used IMAP which worked only after some tinkering with the environment.
Triple checked domain name - it’s fine. In fact, if either domain name is wrong or login information is wrong - appropriate error message pops up in Email Account setup (when it’s active). Neither do in my case, only if I purposefully introduce a typo.
I’d be happy to use IMAP instead, but in this case I am not in control.
@clarkej
Atificially made receive.py script to raise Exception with args that are provided to POP3 init…
Changed this:
class TimerMixin(object):
def __init__(self, *args, **kwargs):
self.timeout = kwargs.pop('timeout', 0.0)
self.elapsed_time = 0.0
self._super.__init__(self, *args, **kwargs)
to this:
class TimerMixin(object):
def __init__(self, *args, **kwargs):
self.timeout = kwargs.pop('timeout', 0.0)
self.elapsed_time = 0.0
raise Exception (str( (args, kwargs)))
self._super.__init__(self, *args, **kwargs)
Which caused expected error:
Title
Error while connecting to email account ERP
Error
Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/email/doctype/email_account/email_account.py”, line 251, in receive
email_server = self.get_incoming_server(in_receive=True, email_sync_rule=email_sync_rule)
File “/home/frappe/frappe-bench/apps/frappe/frappe/email/doctype/email_account/email_account.py”, line 163, in get_incoming_server
email_server.connect()
File “/home/frappe/frappe-bench/apps/frappe/frappe/email/receive.py”, line 46, in connect
return self.connect_pop()
File “/home/frappe/frappe-bench/apps/frappe/frappe/email/receive.py”, line 74, in connect_pop
self.pop = Timed_POP3(self.settings.host, timeout=frappe.conf.get(“pop_timeout”))
File “/home/frappe/frappe-bench/apps/frappe/frappe/email/receive.py”, line 550, in init
raise Exception (str( (args, kwargs) ))
Exception: ((u’pop3.domain.com’,), {})
The ( original ) domain was fine.
@rmehta
Also tried to check whether POP3 is used instead of say IMAP.
added line :
raise Exception(str(self._super))
which resulted in:
Exception: poplib.POP3
so… I’m out of ideas
The issue might also be as trivial as server time-outing to respond properly, but I just don’t know if that’s the case considering current error output.