Python
  Home arrow Python arrow Page 2 - A PyMailGUI Demo
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
PYTHON

A PyMailGUI Demo
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 1
    2007-07-19


    Table of Contents:
  • A PyMailGUI Demo
  • Loading Mail
  • Threading Model
  • Load Server Interface

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    A PyMailGUI Demo - Loading Mail
    ( Page 2 of 4 )

    Now, let’s go back to the PyMailGUI main server list window, and click the Load button to retrieve incoming email over the POP protocol. PyMailGUI’s load function gets account parameters from the mailconfig module listed later in this chapter,


    Figure 15-5.  PyMailGUI attached PyEdit info box

    so be sure to change this file to reflect your email account parameters (i.e., server names and usernames) if you wish to use PyMailGUI to read your own email.

    The account password parameter merits a few extra words. In PyMailGUI, it may come from one of two places:

    Local file
      
    If you put the name of a local file containing the 
       password in the mailconfig module, PyMailGUI 
       loads the password from that file as needed.

    Popup dialog
      
    If you don’t put a password filename in mailconfig 
       (or if PyMailGUI can’t load it from the file for whatever
       reason), PyMailGUI will instead ask you for your 
       password anytime it is needed.

    Figure 15-6 shows the password input prompt you get if you haven’t stored your password in a local file. Note that the password you type is not shown—a show='*' option for the Entry field used in this popup tells Tkinter to echo typed characters as stars (this option is similar in spirit to both the getpass console input module we met earlier in the prior chapter, and an HTML type=password option we’ll meet in a later chapter). Once entered, the password lives only in memory on your machine; PyMailGUI itself doesn’t store it anywhere in a permanent way.

    Also notice that the local file password option requires you to store your password unencrypted in a file on the local client computer. This is convenient (you don’t need to retype a password every time you check email), but it is not generally a good idea on a machine you share with others; leave this setting blank in mailconfig if you prefer to always enter your password in a popup.

    Once PyMailGUI fetches your mail parameters and somehow obtains your password, it will next attempt to pull down the header text of all your incoming email from your inbox on your POP email server. On subsequent loads, only newly arrived mails are loaded, if any.


    Figure 15-6.  PyMailGUI password input dialog

    To save time, PyMailGUI fetches message header text only to populate the list window. The full text of messages is fetched later only when a message is selected for viewing or processing, and then only if the full text has not yet been fetched during this session. PyMailGUI reuses the load-mail tools in the mailtools module of Chapter 14 to fetch message header text, which in turn uses Python’s standard poplib module to retrieve your email.



     
     
    >>> More Python Articles          >>> More By O'Reilly Media
     

       

    PYTHON ARTICLES

    - Tuples and Other Python Object Types
    - The Dictionary Python Object Type
    - String and List Python Object Types
    - Introducing Python Object Types
    - Mobile Programming using PyS60: Advanced UI ...
    - Nested Functions in Python
    - Python Parameters, Functions and Arguments
    - Python Statements and Functions
    - Statements and Iterators in Python
    - Sequences and Sets in Python
    - Python Expressions and Operators
    - Dictionaries, Variables and Statements in Py...
    - Data Types in Python
    - The Python Language
    - SSH with Twisted





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek