CS-2910 Network Protocols

Dr. Mark Sebern -- Fall quarter 2014-2015


Lab 6: Processing email messages from IMAP

Revised: 22 October 2014

Lab assignment

This is a team assignment; each team should be two members unless a different size is approved by the instructor.

Introduction

The goal of this lab is to write (actually, modify) a short Python program, to parse an email message received via IMAP, using the Python email module. The resulting program will read the raw text of an email from a file, and store each part, properly decoded, in a separate file.

Procedure

  1. Download the skeleton Python template: cs2910-lab-email-template-py.txt
  2. Rename the template file to cs2910-lab06-username1-username2{-username3}.py, where each "usernameN" is the MSOE email username (e.g., "smithj") of a team member, in alphabetical order.
  3. Edit the header of the file to include your team members' names, in the format provided.
  4. Complete the process_part method decode at least the following content types:

    • base64
    • quoted-printable (Hint: look at the import statements at the top of the code.

    Unknown content types should not be processed (return the same text), though if that does not produce the right result, you might investigate decoding options.

  5. Test your resulting program on various emails, fetched with the code from Exercise 09, or something similar. Make sure you get come more complex ones, like:
    • Attachments of various types
    • "Reply" messages with the original message included at the bottom.
    • Combinations of various parts (e.g., forwarded message that had an attachment) You will likely have to add the proper file type (extension) to the file names in order to open each part with an appropriate application.
  6. Add comments at the end of your Python file, with the following information:
    • What you learned about the structure of email messages, parts, and decoding.
    • A description of the functionality you implemented and the results of your testing.
    • Comments on your experience in completing the lab, including any problems you encountered. Briefly explain what you learned.
    • Questions and suggestions.

Additional implementation details will be discussed in class. If you have questions about these requirements, ask in class or lab.

If this base functionality turns out to be too easy, you may experiment with adding additional functions, but be sure the basic requirements are still met. Make sure you always have a working backup copy before adding features.

Try to divide up the primary responsibility for parts of the program in an equitable way.

Submission (Due Tuesday, 10/28/2014, 9PM)

One team member should submit your Python file by uploading to the CS-2910-031 Submissions folder on box.msoe.edu. If you have questions about this process, consult the instructor well in advance of the submission deadline.

Please follow these submission instructions exactly, including details of the filename, or your submission may be rejected, resulting in a "F" grade.