Package org.subethamail.smtp.server

Examples of org.subethamail.smtp.server.SMTPServer


   * The default port is 25. Call setPort()/setHostname() before
   * calling start().
   */
  public Wiser()
  {
    this.server = new SMTPServer(new SimpleMessageListenerAdapter(this));
  }
View Full Code Here


      public boolean accept(String from, String recipient)
      {
        return false;
      }
    });
    SMTPServer smtpServer = new SMTPServer(handlerFactory);
    smtpServer.setPort(0);
    smtpServer.start();
    try
    {
      SmartClient client = new SmartClient("localhost", smtpServer.getPort(), "test-client.example.org");
      client.from("john@exmaple.com");
      client.to("jane@example.org");
      client.quit();
    }
    finally
    {
      smtpServer.stop();
    }
  }
View Full Code Here

        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);
View Full Code Here

     *
     * @throws Exception
     */
    @PostConstruct
    public void startup() throws Exception {
        server = new SMTPServer(new SimpleMessageListenerAdapter(listener));
        server.setBindAddress(InetAddress.getLoopbackAddress());
        server.setPort(BIND_PORT);
        server.start();
    }
View Full Code Here

     * @param logger Used to log error messages.
     */
    public void start(final Logger logger) {
        logInfo(logger, "com.btmatthews.maven.plugin.emailserver.subethasmtp.starting");
        final MessageHandlerFactory messageHandlerFactory = new SimpleMessageHandlerFactory();
        server = new SMTPServer(messageHandlerFactory);
        if (isUseSSL()) {
            server.setPort(DEFAULT_SMTPS_PORT + getPortOffset());
            server.setEnableTLS(true);
            server.setRequireTLS(true);
        } else {
View Full Code Here

    private static SMTPServer SERVER;

    @BeforeClass
    public static void startEmbeddedServer() {
        assertNull("Server already initialized", SERVER);
        SERVER = new SMTPServer(new SimpleMessageListenerAdapter(SmtpServerListener.INSTANCE));
        SERVER.setHostName("localhost");
        SERVER.setPort(TEST_PORT);
        SERVER.start();
        System.out.println("Started embedded server on port " + SERVER.getPort());
    }
View Full Code Here

    /** Smtp server instance */
    private SMTPServer smtpServer;

    @Override
    protected void startup() {
        smtpServer = new SMTPServer(new SimpleMessageListenerAdapter(this));
        smtpServer.setSoftwareName(getName());
        smtpServer.setPort(port);
        smtpServer.start();
    }
View Full Code Here

 
  public void testSendMailWithChangedPort() throws Throwable {
   
    MockMessageHandlerFactory myFactory2 = new MockMessageHandlerFactory();
    MockAuthenticationHandlerFactory myAuthFactory2 = new MockAuthenticationHandlerFactory();
    SMTPServer smtpServer2 = new SMTPServer(myFactory2, myAuthFactory2);
        smtpServer2.setPort(25001);
        smtpServer2.start();
   
    MailConfig originaryConfig = this._mailManager.getMailConfig();
    try {
      MailConfig config = this._mailManager.getMailConfig();
      config.setSmtpPort(25001);
      this._mailManager.updateMailConfig(config);
      String[] mailAddresses = JpmailTestHelper.MAIL_ADDRESSES;
      this._mailManager.sendMail(MAIL_TEXT, "Mail semplice", mailAddresses, mailAddresses, mailAddresses, SENDER_CODE);
    } catch (Throwable t) {
      throw t;
    } finally {
      this._mailManager.updateMailConfig(originaryConfig);
      this.checkOriginaryConfig(originaryConfig);
    }
   
    myFactory2 = null;
    myAuthFactory2 = null;
    smtpServer2.stop();
    smtpServer2 = null;
  }
View Full Code Here

 
  @Override
  protected void setUp() throws Exception {
    this._myFactory = new MockMessageHandlerFactory();
    this._myAuthFactory = new MockAuthenticationHandlerFactory();
    this._smtpServer = new SMTPServer(this._myFactory, this._myAuthFactory);
    this._smtpServer.setPort(25000);
    this._smtpServer.start();
    super.setUp();
  }
View Full Code Here

/** @author Julien Viet */
public class Support {

  protected SMTPServer createServer(MessageHandlerFactory mhf) {
    return new SMTPServer(mhf);
  }
View Full Code Here

TOP

Related Classes of org.subethamail.smtp.server.SMTPServer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.