コード例 #1
0
ファイル: MailServer.java プロジェクト: nitinjadhav/citrus
 @Override
 protected void startup() {
   smtpServer = new SMTPServer(new SimpleMessageListenerAdapter(this));
   smtpServer.setSoftwareName(getName());
   smtpServer.setPort(port);
   smtpServer.start();
 }
コード例 #2
0
 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);
   }
 }
コード例 #3
0
 public void stop() {
   try {
     smtpReceivingServer.stop();
   } catch (Exception e) {
     log.debug("exception stopping smtp receiver: " + e.getMessage()); // probably interrupted ex
   }
   smtpReceivingServer = null;
 }
コード例 #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);
  }
コード例 #5
0
 public void deactivate(ComponentContext context) throws Exception {
   LOGGER.info("Stopping SMTP server");
   server.stop();
 }
コード例 #6
0
ファイル: MailServer.java プロジェクト: nitinjadhav/citrus
 @Override
 protected void shutdown() {
   smtpServer.stop();
 }