public void conInit() {             //连接smtp服务器
  try{
    parms.socket=new Socket(hostText.getText(),Integer.parseInt(portText.getText()));
    parms.input=new BufferedReader(new InputStreamReader(parms.socket.getInputStream()));
    parms.output=new PrintWriter(parms.socket.getOutputStream());
    conBt.setEnabled(false);
    hostText.setEditable(false);
    portText.setEditable(false);
    JOptionPane msgbox=new JOptionPane();
  JOptionPane.showMessageDialog(null,"连接服务器成功!","success",0);
  sendBt.setEnabled(true);
  }catch(java.net.UnknownHostException ex){
  JOptionPane msgbox=new JOptionPane();
  JOptionPane.showMessageDialog(null,"无法连接邮件服务器!","error",0);
  }catch(IOException e){
  JOptionPane msgbox=new JOptionPane();
  JOptionPane.showMessageDialog(null,"出错!","error",0);
}catch(NumberFormatException e){
  JOptionPane msgbox=new JOptionPane();
  JOptionPane.showMessageDialog(null,"端口号请填数字!","error",0);
}}  void conBt_actionPerformed(ActionEvent e) {
    conInit();
  }}
class paramenters{
  Socket socket;
  PrintWriter output;
  BufferedReader input;
}class mailSend_quitBt_actionAdapter implements java.awt.event.ActionListener {
  mailSend adaptee;  mailSend_quitBt_actionAdapter(mailSend adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.quitBt_actionPerformed(e);
  }
  protected void sendCommand(String cmd){  }
}class mailSend_sendBt_actionAdapter implements java.awt.event.ActionListener {
  mailSend adaptee;  mailSend_sendBt_actionAdapter(mailSend adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.sendBt_actionPerformed(e);
  }
}class mailSend_conBt_actionAdapter implements java.awt.event.ActionListener {
  mailSend adaptee;  mailSend_conBt_actionAdapter(mailSend adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.conBt_actionPerformed(e);
  }
}
最后我是连接smtp.163.com服务器,得到得相应如下:
正在连接服务器..........
Receive:  220 Coremail SMTP(Anti Spam) System (163com[20030606])
Command:  HELO:smtp.163.com
Receive:  null
Command:  MAIL FROM: [email protected]
Receive:  null
Command:  RCPT TO: [email protected]
Receive:  null
DATA
Subject:fdasfdto:[email protected]:  null
Command:  QUIT
Receive:  null
为什么我发出HELO命令却没有得到回复?好像后面得命令都没有回复得,是我得命令错了吗?大家帮忙改改啊!