transcript.append(response); transcript.append(CRLF);
Log.log(Log.DEBUG,this,response);
	public void run()	{		JEditTextArea textArea = view.getTextArea();		String smtp = this.smtp.getText();		String from = this.from.getText();		String to = this.to.getText();		String subject = this.subject.getText();		boolean selectionOnly = this.selectionOnly.getModel()			.isSelected();		if(smtp.length() == 0 || from.length() == 0			|| to.length() == 0)		{			GUIUtilities.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(BorderLayout.SOUTH,			new JScrollPane(transcript));		pack();		Object[] args = { smtp };		transcript.append(jEdit.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("Subject: " + subject);			out.write(CRLF);			out.write("X-Mailer: jEdit " + jEdit.getVersion());			out.write(CRLF);			out.write(CRLF);			Buffer buffer = view.getBuffer();						int startLine, endLine;			if(selectionOnly)			{				startLine = textArea.getSelectionStartLine();				endLine = textArea.getSelectionEndLine();			}			else			{				startLine = 0;				endLine = textArea.getLineCount() - 1;			}						for(int i = startLine; i <= endLine; i++)			{				String line;				if(selectionOnly)				{					int start = textArea.getSelectionStart(i);					int end = textArea.getSelectionEnd(i);					line = textArea.getText(start,end - start);				}				else				{					line = textArea.getLineText(i);				}				if(line.equals("."))					line = "!"; // XXX use =nn code				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();			GUIUtilities.error(view,"ioerror",args);		}		catch(NumberFormatException nf)		{			GUIUtilities.error(view,"badport",new Object[0]);		}		save();		dispose();	}