command = "MAIL FROM: \"" + from + "\"" + CRLF;
command = "MAIL FROM: <" + from + ">" + CRLF;
	public void run()	{		String smtp = this.smtp.getText();		String from = this.from.getText();		String to = this.to.getText();		String subject = this.subject.getText();		if(smtp.length() == 0 || from.length() == 0			|| to.length() == 0)		{			jEdit.error(view,"sendempty",new Object[0]);			return;		}		this.smtp.setEnabled(false);		this.from.setEnabled(false);		this.to.setEnabled(false);		this.subject.setEnabled(false);		JTextArea transcript = new JTextArea();		transcript.setRows(10);		transcript.setEditable(false);		getContentPane().remove(buttons);		getContentPane().add("South",new JScrollPane(transcript));		pack();		Object[] args = { smtp };		transcript.append(jEdit.props.getProperty("send.connect",			args));		transcript.append(CRLF);		try		{			int index = smtp.indexOf(':');			int port = 25;			if(index != -1)			{				port = Integer.parseInt(smtp.substring(index					+ 1));				smtp = smtp.substring(0,index);			}			Socket socket = new Socket(smtp,port);			BufferedReader in = new BufferedReader(new				InputStreamReader(socket.getInputStream()));			Writer out = new OutputStreamWriter(socket				.getOutputStream());			String response = in.readLine();			transcript.append(response);			transcript.append(CRLF);			if(!response.startsWith("220"))				error("serverdown");			String command = "HELO " + socket.getLocalAddress()				.getHostName() + CRLF;			transcript.append(command);			out.write(command);			out.flush();			response = in.readLine();			transcript.append(response);			transcript.append(CRLF);			if(!response.startsWith("250"))				error("badhost");			command = "MAIL FROM: \"" + from + "\"" + CRLF;			transcript.append(command);			out.write(command);			out.flush();			response = in.readLine();			transcript.append(response);			transcript.append(CRLF);			if(!response.startsWith("250"))				error("badsender");			command = "RCPT TO: \"" + to + "\"" + CRLF;			transcript.append(command);			out.write(command);			out.flush();			response = in.readLine();			transcript.append(response);			transcript.append(CRLF);			if(!response.startsWith("250"))				error("badrecepient");			command = "DATA" + CRLF;			transcript.append(command);			out.write(command);			out.flush();			response = in.readLine();			transcript.append(response);			transcript.append(CRLF);			if(!response.startsWith("354"))				error("badmsg");			out.write("X-Mailer: jEdit " + jEdit.VERSION				+ " build " + jEdit.BUILD);			out.write(CRLF);			Buffer buffer = view.getBuffer();			Element map = buffer.getDefaultRootElement();			int lines = map.getElementCount();			for(int i = 0; i < lines; i++)			{				Element lineElement = map.getElement(i);				int start = lineElement.getStartOffset();				String line = buffer.getText(start,					lineElement.getEndOffset() -						(start + 1));				if(".".equals(line))					out.write(":");				else					out.write(line);				out.write(CRLF);			}			out.write("." + CRLF);			out.flush();			response = in.readLine();			transcript.append(response);			transcript.append(CRLF);			if(!response.startsWith("250"))				error("badmsg");			command = "QUIT" + CRLF;			transcript.append(command);			out.write(command);			out.flush();			response = in.readLine();			transcript.append(response);			transcript.append(CRLF);			in.close();			out.close();			socket.close();		}		catch(IOException io)		{			args[0] = io.toString();			jEdit.error(view,"ioerror",args);		}		catch(NumberFormatException nf)		{			jEdit.error(view,"badport",new Object[0]);		}		catch(BadLocationException bl)		{		}		dispose();	}