@Override
 public void run() {
   try {
     System.out.println("Connecting");
     smtpClient.connect();
   } catch (SMTPSendingFailedException e) {
     System.out.println("Sending failed");
   }
   System.out.println("Sending");
   smtpClient.sendMessage(mimeMessage);
   System.out.println("Closing");
   smtpClient.close();
 }
  public void run() {
    // Make sure that the client and the parameters are not null.
    if (m_SMTPClient == null
        || m_server == null
        || m_domain == null
        || m_sender == null
        || m_recipient == null
        || m_data == null) {
      throw new IllegalArgumentException();
    }

    try {
      // Perform the sequence of steps required to send a message.
      m_SMTPClient.connect(m_server);
      m_SMTPClient.processResponses();
      m_SMTPClient.ehlo(m_domain);
      m_SMTPClient.processResponses();
      m_SMTPClient.mailFrom(m_sender, null);
      m_SMTPClient.processResponses();
      m_SMTPClient.rcptTo(m_recipient, null);
      m_SMTPClient.processResponses();
      m_SMTPClient.data();
      m_SMTPClient.processResponses();
      m_SMTPClient.send(new ByteArrayInputStream(m_data.getBytes()));
      m_SMTPClient.processResponses();
    } catch (Exception e) {
      System.out.println("SMTPSendThread.java");
      System.out.println(e);
    }
  }