CIS 432/532 Introduction to Computer Networks
Winter 2001

Program #2: Mail User Agent
Due February 19th, 3:00 PM, online and in class

Overview

You will write a mail user agent that allows a user to send mail by connecting to an SMTP mail server. You may choose to write your program in either Java or C, following the guidelines below.

User Agent Functionality

Your program should have the following interface:

The user should be able to:

When parsing addresses, the user agent should allow for two cases: (a) an address with a single "@" in it, and (b) an address with no "@" in it. In the first case, the agent should use the RCPT TO command to send the mail and assume it contains a valid user and domain name. In the second case, the agent should first use the VRFY command to look up the full address of the user, then use this to issue the RCPT TO command. If you receive an error code when trying to verify an address, you should handle it by reporting a clear error message to the user and allowing the user to re-enter the address.

SMTP Commands

IMPORTANT: You should only connect to mailhost.cs.uoregon.edu as a mail server when sending mail.

Your user agent should be able to issue the following commands:

Command Meaning
HELO opening handshake
MAIL FROM user the mail is from
RCPT TO user the mail is going to
VRFY lookup a user's address
DATA message being sent
QUIT close connection

Your user agent should be able to handle the following reply codes:

Reply Code Meaning
220 service is ready (from HELO)
221 service is closing connection (from QUIT)
250 action OK, service ready (from MAIL, RCPT, VRFY, DATA)
354 start mail input (from DATA)
550 user unknown (from MAIL, RCPT, VRFY)

If you find that you need to handle other reply codes to build a robust user agent, then implement those too. If you can document what causes the reply code, and how I can use you client to see this behavior, then you will receive extra credit for this work.

See RFC 821 for details on SMTP, and RFC 822 for details on how to format a mail message (the part typed after the DATA command is entered).

Java Version

If you decide to write the program in Java, then you must implement the user agent using a GUI. There is sample code and further explanation online with the Kurose & Ross textbook.

IMPORTANT: Ignore any conflicting directions in the sample code. I am specifying things a little differently. This means you may also need to change the sample code significantly in order to handle things the way I have described them.

C Version

If you decide to write the program in C, then you can handle all input and output through standard input and output. If you want to try something different, try using Qt as a GUI builder. This will definitely take more time, so build the command-line version first so you can have something to turn in. If you are interested in this, then I will try to get systems staff to install Qt for us.

Compiling and Running

You must supply a script called compile that will compile your Java code or a Makefile that will compile your C code. You must also include a README file telling me how to run your program. You can call your executable anything you want.

Grading

Your programs will be tested by using it to send mail. I will expect it to handle addresses of the form zappala and zappala@cs.uoregon.edu. I will enter bad addresses to test that you handle the 550 error code gracefully.

You can receive extra credit if you implement other reply codes described in RFC 821, provided you describe in the README file how I can use your client to see this behavior. You can also get some extra credit by implementing extra message lines as described in RFC 822.

Any program that does not compile will receive a 0.

Turning in the Assignment

You must submit all your source code online. Do not submit any object code. Use the submission instructions for this program, which are available in the Schedule section of the class web page.

You must also print out and fill in the survey for this program. The survey is also available in the Schedule section of the class web page.