POP connection and authentication with APOP : SMTP : Network PYTHON TUTORIALS


PYTHON TUTORIALS » Network » SMTP »

 

POP connection and authentication with APOP


import getpass, poplib, sys
host = "server.com"
user = "userName"
passwd = "password"

p = poplib.POP3(host)
try:
    print "authenticating..."
    p.apop(user, passwd)
except poplib.error_proto:
    try:
        p.user(user)
        p.pass_(passwd)
    except poplib.error_proto, e:
        print "Login failed:", e
        sys.exit(1)

status = p.stat()
print "Mailbox has %d messages for a total of %d bytes" (status[0], status[1])
p.quit()



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo Network
» SMTP