my problem comes up with the code is creating an envelope it keeps saying that envelope can not be resolved to a variable any idea on how to fix this?
import java.io.*;
import java.net.*;
import java.awt.*;
import java.awt.event.*;
/* $Id: MailClient.java,v 1.7 1999/07/22 12:07:30 kangasha Exp $ */
* A simple mail client with a GUI for sending mail.
public class MailClient extends Frame {/* The stuff for the GUI. */
private Button btSend = new Button("Send");
private Button btClear = new Button("Clear");
private Button btQuit = new Button("Quit");
private Label serverLabel = new Label("Local mailserver:");
private TextField serverField = new TextField("", 40);
private Label fromLabel = new Label("From:");
private TextField fromField = new TextField("", 40);
private Label toLabel = new Label("To:");
private TextField toField = new TextField("", 40);
private Label subjectLabel = new Label("Subject:");
private TextField subjectField = new TextField("", 40);
private Label messageLabel = new Label("Message:");
private TextArea messageText = new TextArea(10, 40);
* Create a new MailClient window with fields for entering all
public MailClient() {
static public void main(String argv[]) {
/* Handler for the Send-button. */
class SendListener implements ActionListener {
public void actionPerformed(ActionEvent event) {
System.out.println("Sending mail");
/* Check that we have the local mailserver */
if ((serverField.getText()).equals("")) {
System.out.println("Need name of local mailserver!");
return;
}
/* Check that we have the sender and recipient. */
if((fromField.getText()).equals("")) {
System.out.println("Need sender!");
return;
}
if((toField.getText()).equals("")) {
System.out.println("Need recipient!");
return;
}
/* Create the message */
Message mailMessage = new Message(fromField.getText(),
toField.getText(),
subjectField.getText(),
messageText.getText());
/* Check that the message is valid, i.e., sender and
recipient addresses look ok. */
if(!mailMessage.isValid()) {
return;
}
/* Create the envelope, open the connection and try to send
the message. */
try {
Envelope envelope = new Envelope(mailMessage,
serverField.getText());
} catch (UnknownHostException e) {
/* If there is an error, do not go further */
return;
}
try {
SMTPConnection connection = new SMTPConnection(envelope);
connection.send(envelope);
connection.close();
} catch (IOException error) {
System.out.println("Sending failed: " + error);
return;
}
System.out.println("Mail sent succesfully!");
}
}
/* Clear the fields on the GUI. */
class ClearListener implements ActionListener {
/* Quit. */
class QuitListener implements ActionListener {
}