schram.net

Extending Eudora with the Python scripting language

The Eudora email application (Windows version) provides a COM (Common Object Model) automation interface which allows access to much of the functionality of Eudora from an external programming language.  You can access mail folders, messages, and check or send mail.  The Python scripting language is an ideal choice for controlling Eudora via the COM interface.

Here is an example python script, which makes Eudora check email:

    from win32com.client import Dispatch
    euApp = Dispatch("Eudora.EuApplication.1")
    euApp.CheckMail()
To run the examples, follow these steps:

1)  Download and install the free Python and the Python Extensions for Windows as described below.

2)  Enable automation in Eudora:  From the menu, choose "Tools / Options...".  Select the "Automation" section and be sure "Automation enabled from this machine" is checked.

3)  Make Python aware of the Eudora COM types.  Find the file makepy.py and double click on it.  On my system, it was installed in c:\python16\win32com\client\makepy.py.  Makepy.py will display a list of COM Automation objects on your system.  Select "Eudora Type Library" and click "Ok".  This generates a file with the type information and only has to be done once.  The examples were tested with Eudora version 4.3.2.

You can then run the examples by running the PythonWin IDE and loading them, or from the command line (assuming the python directory is in your path) like this:  python example.py

You can also double-click on the file name from Explorer, however it won't pause at the end to let you see the results.

These scripts and instructions are supplied with no warranty.

Example 1: eudcheck.py  Makes Eudora check email.

Example 2: eudmsgs.py  Print the subject of every message in the Eudora "In" folder.

Here's the script:

    from win32com.client import Dispatch 
    euApp = Dispatch("Eudora.EuApplication.1")
    fol = euApp.Folder("In", 0) 
    msgs = fol.Messages 
    for k in range(1,msgs.Count + 1):
        m = msgs.Item(k)
        print m.Subject

Example 3: eudevents.py  Demonstrates handling events generated by Eudora.  When you check email, you might expect the event OnCheckMailComplete to be fired when it's completely done downloading email, but this script shows it fires much earlier than that.

Example 4: euddate.py  Scan the inbox and move messages to the trash based on subject and age.

You can also move messages from one folder to another and send email via Eudora.  I would prefer to use Python's nice SMTP library for sending mail.

It would be nice if Qualcomm would add some features to the COM interface, for example, to allow easy forwarding or redirect of a message.

If you make some interesting scripts using this technique, please email them to me.   With your permission, I may post them here.


Where to get Python

Python is an interpreted, interactive, object-oriented, open-source programming language that is free for use.  For more information, see:  What is Python? at python.org.

To run these examples, you need to install the Python language and the Python extensions for Windows.

Option 1:

Download the latest Python distribution from python.org.  Download the Python Extensions For Windows (win32all) from ActiveState.  Be sure you get the version that matches the version of Python that you downloaded.
Option 2:
Download the ActivePython distribution from ActiveState which includes both.

Eudora COM documentation

QUALCOMM Eudora Developers Information The Eudora COM interface specification and sample code written in Microsoft Visual Basic.  You don't need the VB sample code, except to read it for ideas to implement in Python.

Eudora Interface Definition (for Eudora 4.3) as output by the Microsoft OLE View utility.

Helpful Python programming books:

Learning Python by Mark Lutz & David Ascher.
Programming Python by Mark Lutz.

Python Essential Reference by David Beazley.  A great reference book to keep on your desk while programming.

Python Programming on Win32 by Mark Hammond and Andy Robinson.  You need this book if you're going to be working with're going to be working with Python and COM.

(Microsoft, Windows and Visual Basic are registered trademarks of Microsoft Corporation.  Eudora is a registered trademark of Qualcomm Incorporated.)


Questions, comments? Email me (the address in the graphic at the top.)

© 2006 Scott Schram (Disclaimer)