Solution for the Mail Client Lab
SMTPConnection.java
import java.net.*;
import java.io.*;
import java.util.*;
/* $Id: SMTPConnection.java,v 1.1.1.1 2003/09/30 14:36:01 kangasha Exp $ */
/**
* Open an SMTP connection to a remote machine and send one mail.
*
* @author Jussi Kangasharju
*/
public class SMTPConnection {
/* The socket to the server */
public Socket connection;
/* Streams for reading and writing the socket */
public BufferedReader fromServer;
public DataOutputStream toServer;
/* Just to make it look nicer */
private static final int SMTP_PORT = 25;
private static final String CRLF = “\r\n”;
/* Are we connected? Used in close() to determine what to do. */