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 6669905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:12:22+00:00 2026-05-26T03:12:22+00:00

This what ive tried so far : # view and delete e-mail using the

  • 0

This what ive tried so far :

# view and delete e-mail using the POP3 protocol

import sys, getpass, poplib, re

# change according to your needs
POPHOST = "pop3.126.com"
POPUSER = "Username"
POPPASS = "pass"

# the number of message body lines to retrieve
MAXLINES = 10
HEADERS = "From To Subject".split()

# headers you're actually interested in
rx_headers  = re.compile('|'.join(HEADERS), re.IGNORECASE)

try:
    # connect to POP3 and identify user
    pop = poplib.POP3(POPHOST)
    pop.user(POPUSER)

    if not POPPASS or POPPASS=='=':
        # if no password was supplied, ask for it
        POPPASS = getpass.getpass("Password for %s@%s:" % (POPUSER, POPHOST))

    # authenticate user
    pop.pass_(POPPASS)

    # get general information (msg_count, box_size)
    stat = pop.stat(  )

    # print some information
    print "Logged in as %s@%s" % (POPUSER, POPHOST)
    print "Status: %d message(s), %d bytes" % stat

    bye = 0
    count_del = 0
    for n in range(stat[0]):

        msgnum = n+1

        # retrieve headers
        response, lines, bytes = pop.top(msgnum, MAXLINES)

        # print message info and headers you're interested in
        print "Message %d (%d bytes)" % (msgnum, bytes)
        print "-" * 30
        print "\n".join(filter(rx_headers.match, lines))
        print "-" * 30

        # input loop
        while 1:
            k = raw_input("(d=delete, s=skip, v=view, q=quit) What?")
            k = k[:1].lower(  )
            if k == 'd':
                # Mark message for deletion
                k = raw_input("Delete message %d? (y/n)" % msgnum)
                if k in "yY":
                    pop.dele(msgnum)
                    print "Message %d marked for deletion" % msgnum
                    count_del += 1
                    break
            elif k == 's':
                print "Message %d left on server" % msgnum
                break
            elif k == 'v':
                print "-" * 30
                print "\n".join(lines)
                print "-" * 30
            elif k == 'q':
                bye = 1
                break

        # done ...
        if bye:
            print "Bye"
            break

    # summary
    print "Deleting %d message(s) in mailbox %s@%s" % (
        count_del, POPUSER, POPHOST)

    # close operations and disconnect from server
    print "Closing POP3 session"
    pop.quit(  )

except poplib.error_proto, detail:

    # possible error
    print "POP3 Protocol Error:", detail

this give me the error:

POP3 Protocol Error: -ERR Unable to log on

Does anyone know what the problem is? I’m using a gmail account and all the login information is correct.

Edit:

ive changed the code up a bit and now i get his error…here the code and the error:

import poplib
user = "username@gmail.com"
passs = "password"
pop = poplib.POP3("pop.gmail.com",995)
pop.user(user)
pop.pass_(passs)

and i get this error:

  File "C:\Python27\lib\poplib.py", line 86, in __init__
    self.welcome = self._getresp()
  File "C:\Python27\lib\poplib.py", line 124, in _getresp
    resp, o = self._getline()
  File "C:\Python27\lib\poplib.py", line 108, in _getline
    if not line: raise error_proto('-ERR EOF')
error_proto: -ERR EOF
  • 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-26T03:12:22+00:00Added an answer on May 26, 2026 at 3:12 am

    i have found code that works…here it is:

    import poplib
    
    M = poplib.POP3_SSL('pop3.live.com', 995) #Connect to hotmail pop3 server
    M.set_debuglevel(2)
    success = False;
    user = "email@hotmail.com"
    
    while success == False:
        try:
            password = raw_input("password: ")
            M.user(user)
            M.pass_(password)
        except:
            print "Invalid credentials"
        else:
            print "Successful login"
            success = True
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i've tried using this code and this to make a random quote generator, but
It feels like this should be fairly simple but nothing i've tried so far
(I've tried this in MySql) I believe they're semantically equivalent. Why not identify this
I've tried this: string newScript = textBox1.Text; HtmlElement head = browserCtrl.Document.GetElementsByTagName(head)[0]; HtmlElement scriptEl =
I've tried this both with and without the 'ExceptionType' parameter. I have an Error.aspx
(I've tried posting this on YUI message group but without any luck) Can anyone
I've tried this with a couple of different plugins, so I'm sure it's not
I've tried this: CATransform3D rotationTransform = [[self.layer presentationLayer] transform]; This will not work, since
I've tried this, but that doesn't work: CATransform3D currentTransform = self.layer.transform; CATransform3D identityTransform =
I've tried this example directly from MSDN: Dim Screens() As System.Windows.Forms.Screens and I can't

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.