POP connection and authentication with APOP : SMTP « Network « Python Tutorial

Home
Python Tutorial
1.Introduction
2.Data Type
3.Statement
4.Operator
5.String
6.Tuple
7.List
8.Dictionary
9.Collections
10.Function
11.Class
12.File
13.Buildin Function
14.Buildin Module
15.Database
16.Regular Expressions
17.Thread
18.Tkinker
19.wxPython
20.XML
21.Network
22.CGI Web
23.Windows
Python Tutorial » Network » SMTP 
21.11.10.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()
21.11.SMTP
21.11.1.Sending Email Using SMTP
21.11.2.Retrieving Email from a POP3 Server
21.11.3.SMTP and POP3 Example
21.11.4.SMTP transmission with authentication
21.11.5.Basic SMTP transmission
21.11.6.SMTP transmission with debugging
21.11.7.POP mailbox downloader
21.11.8.POP mailbox scanning
21.11.9.POP connection and authentication
21.11.10.POP connection and authentication with APOP
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.