Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6000513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:42:15+00:00 2026-05-23T00:42:15+00:00

I am working on an email client and have run into a small problem.

  • 0

I am working on an email client and have run into a small problem. I am unsure of how to download the email messages and save them to the local HDD. I am able to connect to the server using IMAP4 SSL (with the code below).

import imaplib
server = imaplib.IMAP4_SSL('imap.gmail.com')
server.login('USER', 'PASS')
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T00:42:15+00:00Added an answer on May 23, 2026 at 12:42 am

    You can list directories in your mailbox with IMAP4.list. To actually get messages out of a directory use IMAP4.select, and then use IMAP4.search, and iterate over the list of id’s it returns. In your case you could do something like this:

    server.select('[Gmail]/All Mail')
    resp, items = server.search(None, "(UNSEEN)")
    for mail in items[0].split():
        resp, data = m.fetch(mail, '(RFC822)')
        body = data[0][1]
        print body
    

    Read the docs for sure: http://docs.python.org/library/imaplib.html. Also agree with this answer, read through PyMOTW’s tutorial. In general it’s a good place to check for tutorials for modules in the standard library.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on an HTML email and have been running to a problem on
I am working on an imap email client. I have a search function, which
I am working on Email client application. I have written one sample program for
Does anyone have a working class or function to create the hashed email that
I'm looking for good/working/simple to use PHP code for parsing raw email into parts.
I am creating Email client using JavaMail API. Everything is working fine like I
I have mailto:test@维奈.com on an image which when clicked opens the email client, but
I am working on an email client application in C#. I want to display
I'm working on a desktop email client right now, and I want to unit
I'm working on a side project right now for an email client. I'm using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.