Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not connecting to iCloud IMAP mailbox #3

Open
williamy2k opened this issue Oct 29, 2022 · 0 comments
Open

Not connecting to iCloud IMAP mailbox #3

williamy2k opened this issue Oct 29, 2022 · 0 comments

Comments

@williamy2k
Copy link

Hello, unfortunately I'm having issues connecting to an iCloud IMAP mailbox

from redbox import EmailBox
from pprint import pprint
import os
import dotenv

dotenv.load_dotenv()

imap_host = os.getenv('imap_host')
imap_user = os.getenv('imap_user')
imap_pass = os.getenv('imap_pass')

box = EmailBox(
    host=imap_host,
    port=993,
    username=imap_user,
    password=imap_pass
)

inbox = box["INBOX"]

for msg in inbox.search(subject='Your Backup Summary'):
    pprint(msg.from_)
    pprint(msg.to)
    pprint(msg.subject)
    pprint(msg.text_body)
    pprint(msg.html_body)

Error message:

Traceback (most recent call last):
  File "/Users/[Redacted]/check_for_code.py", line 19, in <module>
    inbox = box["INBOX"]
  File "/Users/[Redacted]/venv/lib/python3.9/site-packages/redbox/box.py", line 37, in __getitem__
    for mailbox in self.mailfolders:
  File "/Users/[Redacted]/venv/lib/python3.9/site-packages/redbox/box.py", line 45, in mailfolders
    self.update()
  File "/Users/[Redacted]/venv/lib/python3.9/site-packages/redbox/box.py", line 83, in update
    items = match.groupdict()
AttributeError: 'NoneType' object has no attribute 'groupdict'

I tried some debugging, but can't see any obvious issue beyond '_connection': None

pprint(box.__dict__)

Output:

{'_EmailBox__password': [Redacted],
 '_connection': None,
 '_mailfolders': None,
 'cls_imap': <class 'imaplib.IMAP4_SSL'>,
 'host': 'imap.mail.me.com',
 'kws_imap': {},
 'port': 993,
 'use_starttls': False,
 'username': [Redacted]}

Other notes

  • I tried setting use_starttls=True but this didn't resolve
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant