Beispiel #1
0
  private void syncUI() {
    boolean started = mailService != null && mailService.isRunning();

    pop3PortLabel.setText(POP3_PORT_LABEL_PREFIX + (started ? mailService.getPop3Port() : ""));
    smtpPortLabel.setText(SMTP_PORT_LABEL_PREFIX + (started ? mailService.getSmtpPort() : ""));
    startButton.setEnabled(!started);
    stopButton.setEnabled(started);
    testMessageButton.setEnabled(started);
  }
Beispiel #2
0
 private void startService() {
   try {
     mailService = new MailService(new FuncTestLoggerImpl());
     mailService.configureAndStartGreenMail(JIRAServerSetup.SMTP_POP3);
     mailService.addUser(DEFAULT_EMAIL_ADDRESS, DEFAULT_USERNAME, DEFAULT_PASSWORD);
     syncUI();
     System.out.println("Mail Service Started.");
   } catch (BindException ex) {
     JOptionPane.showMessageDialog(null, ex.getMessage());
   }
 }
Beispiel #3
0
 private void stopService() {
   if (mailService != null) {
     mailService.stop();
     syncUI();
     System.out.println("Mail Service Stopped.");
   }
 }
Beispiel #4
0
 private void sendTestMessage() {
   if (mailService != null) {
     final String subject = "SwingMail Test Message";
     String body =
         "Hi, I'm a test message from your mail service interface. "
             + "If you're reading me your mail setup is good.";
     mailService.sendTextMessage(DEFAULT_EMAIL_ADDRESS, DEFAULT_EMAIL_ADDRESS, subject, body);
     System.out.println("Test message sent to " + DEFAULT_EMAIL_ADDRESS + ".");
   }
 }