Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
imaplib problem
#4
(Jul-13-2019, 05:29 PM)micseydel Wrote: Can you re-frame your question with 5-10 lines of code (in code tags) along with any instructions for how to get the code to reproduce the problem?

Sure

For imap initialization
def imap_init():
    """
    Initialize IMAP connection
    """
    print("Initializing IMAP... ")
    global i
    i = imapclient.IMAPClient(imapserver, ssl_context=ssl_context)
    c = i.login(radr, pwd)
    i.select_folder("INBOX", readonly=True)
    print("Done. ")
for fetch unread emails

def get_unread():
    global i
    uids = i.search(['UNSEEN'])
    if not uids:
        return None
    else:
        print("Found %s unreads" % len(uids))
        return i.fetch(uids, ['BODY[]', 'FLAGS']) 
Reply


Messages In This Thread
imaplib problem - by levann - Jul-12-2019, 01:08 PM
RE: imaplib problem - by levann - Jul-12-2019, 02:27 PM
RE: imaplib problem - by micseydel - Jul-13-2019, 05:29 PM
RE: imaplib problem - by levann - Jul-15-2019, 10:05 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Assistance debuging imaplib errors Linh_lee 1 1,059 Aug-21-2022, 05:57 PM
Last Post: Linh_lee
  IMAPLib Has No Attribute IMAP4_SSL. Help! bmccollum 3 3,924 Jun-13-2020, 04:34 AM
Last Post: bmccollum
  How can read and download the attachment from the mail using while loop in IMAPlib Py Samjith 0 4,297 Oct-11-2018, 07:15 AM
Last Post: Samjith
  Email Checker with IMAPlib ronaldrios 1 3,821 Jun-23-2017, 04:03 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020