CS-2910 Network Protocols

Dr. Mark Sebern -- Fall quarter 2014-2015

Lab 5: Sending email with SMTP

Revised: 15 October 2014

Lab assignment

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


The goal of this lab is to write a short Python program, to send an email message to an email server, using the SMTP protocol, STARTTLS security, and AUTH LOGIN authentication.


  1. Download the skeleton Python template: cs2910-lab-smtp-template-py.txt
  2. Rename the template file to cs2910-lab05-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 smtp_send method to send an email message with at least the following content:

    • Email header
      • From
      • To (one recipient; optionally, you may add more by using a list of strings for this value)
      • Subject
      • Date
    • Email text (may be multiple lines)

    Optionally, you may add other capabilities, such as sending an attachment, but make sure that all the required functionality is completely working first.

    You will want to add other helper methods, but do not change the any other code provided in the template.

  5. Add comments at the end of your Python file, with the following information:
    • 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.

You may not use a prebuilt library like Lib/smtplib; the point of this lab is for you to understand the low-level implementation of the SMTP protocol.

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.

Hints and Notes

Submission (Due Monday, 10/20/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.