import javabook.*; import dmusican.*; class MessageMain { public static void main(String[] args) { /* Set up all of the basics, except for the "to" address. I want to make sure not to flood someone's mailbox, so I am going to require that the "to" email address be entered every time the program is run. */ Message message = new Message(); message.setFrom("dmusican@carleton.edu"); message.setSubject("Test message"); message.setText("Hi!\n\nThis is a test message. If you should not\n" + "have received this message, please email me\n" + "a response and I'll see to it that this never\n" + "happens again."); /* Determine who the message is addressed to */ MainWindow mw = new MainWindow(); mw.toFront(); InputBox ib = new InputBox(mw); String to = ib.getString("Who is the message to?"); message.setTo(to); /* Print out all the information known about the message */ OutputBox ob = new OutputBox(mw); ob.setVisible(true); ob.toFront(); ob.printLine("To: " + message.getTo()); ob.printLine("From: " + message.getFrom()); ob.printLine("Subject: " + message.getSubject()); ob.printLine("Timestamp: " + message.getTimestamp()); ob.printLine(message.getText()); /* Send the message */ message.send(); } }