Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Python Networking

You're reading from   Learning Python Networking Utilize Python 3 to get network applications up and running quickly and easily

Arrow left icon
Product type Paperback
Published in Jun 2015
Publisher
ISBN-13 9781784396008
Length 320 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Toc

Table of Contents (12) Chapters Close

Preface 1. Network Programming and Python 2. HTTP and Working with the Web FREE CHAPTER 3. APIs in Action 4. Engaging with E-mails 5. Interacting with Remote Systems 6. IP and DNS 7. Programming with Sockets 8. Client and Server Applications 9. Applications for the Web A. Working with Wireshark Index

Retrieving e-mails by using POP3 with poplib


The stored e-mail messages can be downloaded and read by the local computer. The POP3 protocol can be used to download the messages from the e-mail server. Python has a module called poplib, and it can be used for this purpose. This module provides two high-level classes, POP() and POP3_SSL(),which implement the POP3 and POP3S protocols respectively for communicating with a POP3/POP3S server. It accepts three arguments, host, port, and timeout. If port is omitted, then the default port (110) can be used. The optional timeout parameter determines the length (in seconds) of the connection timeout at the server.

The secure version of POP3() is its subclass POP3_SSL(). It takes additional parameters, such as keyfile and certfile, which are used for supplying the SSL certificate files, namely the private key and certificate chain file.

Writing for a POP3 client is also very straightforward. To do this, instantiate a mailbox object by initializing the...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime