Forums

"[Errno 111] Connection refused" using imaplib

Hi ! I'm working on a bot that checks daily an email adress for an organisation. My code is working perfectly on my computer so I've tried to execute it on pythonanywhere but I've this error :

Traceback (most recent call last):
  File "/home/YFCToulouse/mailing list.py", line 11, in <module>
    with imaplib.IMAP4_SSL(host="mail.mailo.com", port=imaplib.IMAP4_SSL_PORT) as imap_ssl:
  File "/usr/local/lib/python3.9/imaplib.py", line 1324, in __init__
    IMAP4.__init__(self, host, port, timeout)
  File "/usr/local/lib/python3.9/imaplib.py", line 202, in __init__
    self.open(host, port, timeout)
  File "/usr/local/lib/python3.9/imaplib.py", line 1337, in open
    IMAP4.open(self, host, port, timeout)
  File "/usr/local/lib/python3.9/imaplib.py", line 312, in open
    self.sock = self._create_socket(timeout)
  File "/usr/local/lib/python3.9/imaplib.py", line 1327, in _create_socket
    sock = IMAP4._create_socket(self, timeout)
  File "/usr/local/lib/python3.9/imaplib.py", line 302, in _create_socket
    return socket.create_connection(address)
  File "/usr/local/lib/python3.9/socket.py", line 843, in create_connection
    raise err
  File "/usr/local/lib/python3.9/socket.py", line 831, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

Sorry for my english, I'm a french people. Thank you for your help

Free accounts have restricted Internet access -- you can only make HTTP or HTTPS requests to external sites, and they have to be on our whitelist of official public APIs.

Okay... Thank you for your answer

I hope that it helped you!