Python
  Home arrow Python arrow Page 4 - Finishing the PyMailGUI Client: User H...
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
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? 
PYTHON

Finishing the PyMailGUI Client: User Help Tools
By: O'Reilly Media
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2007-08-09

    Table of Contents:
  • Finishing the PyMailGUI Client: User Help Tools
  • popuputil: General-Purpose GUI Pop Ups
  • wraplines: Line Split Tools
  • mailcon
  • PyMailGuiHelp: User Help Text
  • Ideas for Improvement

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb 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

    TestComplete™ automates software testing for a fraction of what the big guys charge. Easy functional and load testing for all Windows, .NET, Java and Web apps. Download a free trial now.

    Finishing the PyMailGUI Client: User Help Tools - mailcon
    (Page 4 of 6 )

    In Example 15-8, PyMailGUI’s mailconfig user settings module is listed. This program has its own version of this module because many of its settings are unique for PyMailGUI. To use the program for reading your own email, set its initial variables to reflect your POP and SMTP server names and login parameters. The variables in this module also allow the user to tailor the appearance and operation of the program without finding and editing actual program logic.

    Example 15-8. PP3E\Internet\Email\PyMailGui\mailconfig.py

    ################################################################# PyMailGUI user configuration settings.
    # Email scripts get their server names and other email config options from
    # this module: change me to reflect your machine names, sig, and preferences.
    # Warning: PyMailGUI won't run without most variables here: make a backup copy!
    # Notes: could get some settings from the command line too, and a configure
    # dialog would be better, but this common module file suffices for now. #################################################################

    #------------------------------------------- # (required for load, delete) POP3 email server machine, user
    #-------------------------------------------

    # popservername = '?Please set your mailconfig.py attributes?'

    #popservername = 'pop.rmi.net' # or starship.python.net, 'localhost'
    #popusername = 'lutz' # password fetched or asked when run
    #popservername = 'pop.mindspring.com' # yes, I have a few email accounts
    #popusername = 'lutz4'
    #popservername = 'pop.yahoo.com'  
    #popusername = 'for_personal_mail'  
    popservername = 'pop.earthlink.net' # pp3e@earthlink.net
    popusername = 'pp3e'  

    #-------------------------------------------
    # (required for send) SMTP email server machine name
    # see Python smtpd module for a SMTP server class to run locally;
    # note: your ISP may require that you be directly connected to their system:
    # I can email through Earthlink on dial up, but cannot via Comcast cable
    #-------------------------------------------

    smtpservername = 'smtp.comcast.net'     # or 'smtp.mindspring.com', 'localhost'

    #-------------------------------------------
    # (may be required for send) SMTP user/password if authenticated
    # set user to None or '' if no login/authentication is required
    # set pswd to name of a file holding your SMTP password, or an
    # empty string to force programs to ask (in a console, or GUI)
    #-------------------------------------------

    smtpuser = None               # per your ISP smtppasswdfile = ''           # set to '' to be asked

    #-------------------------------------------
    # (optional) PyMailGUI: name of local one-line text file with your POP
    # password; if empty or file cannot be read, pswd is requested when first
    # connecting; pswd not encrypted: leave this empty on shared machines;
    # PyMailCGI always asks for pswd (runs on a possibly remote server);
    #-------------------------------------------

    poppasswdfile =
    r'c:\temp\pymailgui.txt'        # set to '' to be asked

    #-------------------------------------------
    # (optional) personal information used by PyMailGUI to fill in edit forms;
    # if not set, does not fill in initial form values;
    # sig  -- can be a triple-quoted block, ignored if empty string;
    # addr -- used for initial value of "From" field if not empty,
    # no longer tries to guess From for replies--varying success;
    #-------------------------------------------

    myaddress   = 'pp3e@earthlink.net'         #
    lutz@rmi.net
    mysignature = '--Mark Lutz (http://www.rmi.net/~lutz)'

    #-------------------------------------------
    # (optional) local file where sent messages are saved;
    # PyMailGUI 'Open' button allows this file to be opened and viewed
    # don't use '.' form if may be run from another dir: e.g., pp3e demos
    #-------------------------------------------

    #sentmailfile   =
    r'.\sentmail.txt'               # . means in current working dir

    #sourcedir    = r'C:\Mark\PP3E-cd\Examples\PP3E\Internet\Email\PyMailGui\' #sentmailfile = sourcedir + 'sentmail.txt'

    # determine auto from one of my source files import wraplines, os
    mysourcedir = os.path.dirname(os.path.abspath(wraplines.__file__))

    sentmailfile = os.path.join(mysourcedir, 'sentmail.txt')

    #-------------------------------------------
    # (optional) local file where pymail saves POP mail;
    # PyMailGUI instead asks for a name with a pop-up dialog
    #-------------------------------------------

    savemailfile =
    r'c:\temp\savemail.txt'        # not used in PyMailGUI: dialog

    #-------------------------------------------
    # (optional) customize headers displayed in PyMailGUI list and view windows;
    # listheaders replaces default, viewheaders extends it; both must be tuple of
    # strings, or None to use default hdrs;
    #-------------------------------------------

    listheaders = ('Subject', 'From', 'Date', 'To', 'X-Mailer')
    viewheaders = ('Bcc',)

    #-------------------------------------------
    # (optional) PyMailGUI fonts and colors for text server/file message list
    # windows, message content view windows, and view window attachment buttons;
    # use ('family', size, 'style') for font; 'colorname' or hexstr '#RRGGBB' for
    # color (background, foreground); None means use defaults; font/color of
    # view windows can also be set interactively with texteditor's Tools menu;
    #-------------------------------------------

    listbg = 'indianred'         # None, 'white', '#RRGGBB' (see setcolor example)

    listfg = 'black'
    listfont = ('courier', 9, 'bold') # None, ('courier', 12, 'bold italic')
     # use fixed-width font for list columns
    viewbg = '#dbbedc'  
    viewfg = 'black'  
    viewfont = ('courier', 10, 'bold')  
    viewheight = 24 # max lines for height when opened
    partfg = None  
    partbg = None  

    # see Tk color names: aquamarine paleturqoise powderblue goldenrod burgundy ....

    #listbg = listfg = listfont = None
    #viewbg = viewfg = viewfont = viewheight = None                      # to use defaults
    #partbg = partfg = None

    #-------------------------------------------
    # (optional) column at which mail's original text should be wrapped for view,
    # reply, and forward; wraps at first delimiter to left of this position;
    # composed text is not auto-wrapped: user or recipient's mail tool must wrap
    # new text if desired; to disable wrapping, set this to a high value (1024?);
    #-------------------------------------------

    wrapsz = 100

    #-------------------------------------------
    # (optional) control how PyMailGUI opens mail parts in the GUI;
    # for view window Split actions and attachment quick-access buttons;
    # if not okayToOpenParts, quick-access part buttons will not appear in
    # the GUI, and Split saves parts in a directory but does not open them;
    # verifyPartOpens used by both Split action and quick-access buttons:
    # all known-type parts open automatically on Split if this set to False;
    # verifyHTMLTextOpen used by web browser open of HTML main text part:
    #-------------------------------------------

    okayToOpenParts = True # open any parts/attachments at all?
    verifyPartOpens = False # ask permission before opening each part?
    verifyHTMLTextOpen = False # if main text part is HTML, ask before open?

    #-------------------------------------------
    # (optional) the maximum number of quick-access mail part buttons to show
    # in the middle of view windows; after this many, a "..." button will be
    # displayed, which runs the "Split" action to extract additional parts;
    #-------------------------------------------

    maxPartButtons = 8           # how many part buttons in view windows

    #end

    More Python Articles
    More By O'Reilly Media


       · This article is an excerpt from the book "Programming Python, Third Edition,"...
     

    Buy this book now. This article is excerpted from chapter 15 of the book Programming Python, Third Edition, written by Mark Lutz (O'Reilly, 2006; ISBN: 0596009259). Check it out today at your favorite bookstore. Buy this book now.

       

    PYTHON ARTICLES

    - SSH with Twisted
    - Mobile Programming in Python using PyS60: UI...
    - Python: Count on It
    - Python Strings: Spinning Yarns
    - Python: More Fun with Strings
    - Python: Stringing You Along
    - Python Operators
    - Bluetooth Programming in Python: Network Pro...
    - Python Sets
    - Python Conditionals, Lists, Dictionaries, an...
    - Python: Input and Variables
    - Introduction to Python Programming
    - Mobile Programming in Python using PyS60: Ge...
    - Bluetooth Programming using Python
    - Finishing the PyMailGUI Client: User Help To...




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway