Title: <mail> task problem and possible solution

Not sure who I should send this to, but I ran into a problem with the mail task and had to make the following modification to the getReady function of org/apache/tools/mail/MailMessage.java:

  void getReady() throws IOException {
    String response = in.readLine();
    int[] ok = { 220 };
    if (!isResponseOK(response, ok)) {
      throw new IOException(
        "Didn't get introduction from server: " + response);
    }
    if (in.ready()) {     // CCH: added
      in.readLine();      // CCH: added
    }                     // CCH: added
  }

The problem was that the Microsoft SMTP server sends a two line introduction.  The second line wasn't being read by getReady(), and so it was erroneously being read as the response to the next command sent to the server.  I don't know that the above is the best solution, but it works for me.

Chris Hilton

Reply via email to