Esempio n. 1
0
 @Override
 protected void startup() {
   smtpServer = new SMTPServer(new SimpleMessageListenerAdapter(this));
   smtpServer.setSoftwareName(getName());
   smtpServer.setPort(port);
   smtpServer.start();
 }
 public void activate(ComponentContext context) throws Exception {
   final String port = System.getProperty("org.sakaiproject.nakamura.SMTPServerPort", "8025");
   LOGGER.info("Starting SMTP server on port {}", port);
   server = new SMTPServer(new SimpleMessageListenerAdapter(this));
   server.setPort(Integer.parseInt(port));
   server.start();
   String localDomains = (String) context.getProperties().get(LOCAL_DOMAINS);
   if (localDomains == null) {
     localDomains = "localhost";
   }
   domains.clear();
   for (String domain : StringUtils.split(localDomains, ';')) {
     domains.add(domain);
   }
 }
Esempio n. 3
0
 public void stop() {
   try {
     smtpReceivingServer.stop();
   } catch (Exception e) {
     log.debug("exception stopping smtp receiver: " + e.getMessage()); // probably interrupted ex
   }
   smtpReceivingServer = null;
 }
Esempio n. 4
0
  protected void initSmtpReceiver() {
    Collection<MessageListener> listeners = new ArrayList<MessageListener>(1);
    listeners.add(this);

    if (enableTls) {
      log.info("Creating TLS enabled server");
      this.smtpReceivingServer = new SMTPServer(listeners);
    } else {
      log.info("Creating TLS DIS-abled server");
      this.smtpReceivingServer = new TlsDisabledSmtpServer(listeners);
    }
    this.smtpReceivingServer.setPort(smtpPort);
    this.smtpReceivingServer.setMaxConnections(30000);
    CommandHandler cmdHandler = this.smtpReceivingServer.getCommandHandler();

    MessageListenerAdapter mla =
        (MessageListenerAdapter) smtpReceivingServer.getMessageHandlerFactory();
    mla.setAuthenticationHandlerFactory(null);
  }
 public void deactivate(ComponentContext context) throws Exception {
   LOGGER.info("Stopping SMTP server");
   server.stop();
 }
Esempio n. 6
0
 @Override
 protected void shutdown() {
   smtpServer.stop();
 }