当前位置: 首页>>代码示例>>Java>>正文


Java SMTPServer.start方法代码示例

本文整理汇总了Java中org.subethamail.smtp.server.SMTPServer.start方法的典型用法代码示例。如果您正苦于以下问题:Java SMTPServer.start方法的具体用法?Java SMTPServer.start怎么用?Java SMTPServer.start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.subethamail.smtp.server.SMTPServer的用法示例。


在下文中一共展示了SMTPServer.start方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startup

import org.subethamail.smtp.server.SMTPServer; //导入方法依赖的package包/类
@Override
public void startup()
{
    serverImpl = new SMTPServer(new HandlerFactory());
    
    // MER - May need to override SMTPServer.createSSLSocket to specify non default keystore.
    serverImpl.setPort(getPort());
    serverImpl.setHostName(getDomain());
    serverImpl.setMaxConnections(getMaxConnections());
    
    serverImpl.setHideTLS(isHideTLS());
    serverImpl.setEnableTLS(isEnableTLS());
    serverImpl.setRequireTLS(isRequireTLS());
    
    if(isAuthenticate())
    {
        AuthenticationHandlerFactory authenticationHandler = new EasyAuthenticationHandlerFactory(new AlfrescoLoginUsernamePasswordValidator());
        serverImpl.setAuthenticationHandlerFactory(authenticationHandler);
    }
    
    serverImpl.start();
    log.info("Inbound SMTP Email Server has started successfully, on hostName:" + getDomain() + "port:" + getPort());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:SubethaEmailServer.java

示例2: start

import org.subethamail.smtp.server.SMTPServer; //导入方法依赖的package包/类
public static StartResult start(int port) {
    try {
        smtpServer = new SMTPServer(new SimpleMessageListenerAdapter(listener), new SMTPAuthHandlerFactory());
        smtpServer.setPort(port);
        smtpServer.start();

        return new StartResult(true, null);
    } catch (Throwable e) {
        log.error("Failed to start SMTP server", e);

        if (e.getCause() instanceof BindException) {
            return new StartResult(false, String.format(Messages.get("%s, port: %s"), e.getCause().getMessage(), port));
        } else if (e.getCause() instanceof IllegalArgumentException && e.getMessage().contains("out of range")) {
            return new StartResult(false, String.format(Messages.get("server.error.outofrange"), port));
        } else {
            return new StartResult(false, e.getLocalizedMessage());
        }
    }
}
 
开发者ID:anlar,项目名称:LunaticSMTP,代码行数:20,代码来源:EmailServer.java

示例3: init

import org.subethamail.smtp.server.SMTPServer; //导入方法依赖的package包/类
public void init() {
    Objects.requireNonNull(rb, "ResourceLoader must be set");
    Objects.requireNonNull(serverConfigurationService, "ServerConfigurationService must be set");
    Objects.requireNonNull(entityManager, "EntityManager must be set");
    Objects.requireNonNull(aliasService, "AliasService must be set");
    Objects.requireNonNull(userDirectoryService, "UserDirectoryService must be set");
    Objects.requireNonNull(siteService, "SiteService must be set");
    Objects.requireNonNull(timeService, "TimeService must be set");
    Objects.requireNonNull(threadLocalManager, "ThreadLocalManager must be set");
    Objects.requireNonNull(contentHostingService, "ContentHostingService must be set");
    Objects.requireNonNull(mailArchiveService, "MailArchiveService must be set");
    Objects.requireNonNull(sessionManager, "SessionManager must be set");

    if (serverConfigurationService.getBoolean("smtp.enabled", false)) {
        server = new SMTPServer(this);

        server.setHostName(serverConfigurationService.getServerName());
        server.setPort(serverConfigurationService.getInt("smtp.port", 25));
        server.setSoftwareName("SubEthaSMTP - Sakai (" + serverConfigurationService.getString("sakai.version", "unknown") +
                ")");
        // We don't support smtp.dns.1 and smtp.dns.2
        server.setMaxConnections(100);
        server.start();
    }
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:26,代码来源:SakaiMessageHandlerFactory.java

示例4: start

import org.subethamail.smtp.server.SMTPServer; //导入方法依赖的package包/类
@PostConstruct
public void start() {
       smtpServer = new SMTPServer(myMessageHandlerFactory);
	smtpServer.setPort(port);
	smtpServer.setHostName(hostName);
	smtpServer.start();

	log.info("****** SMTP Server is running for domain " + smtpServer.getHostName()
			+ " on port " + smtpServer.getPort());
}
 
开发者ID:dopse,项目名称:maildump,代码行数:11,代码来源:SmtpServerLauncher.java

示例5: startup

import org.subethamail.smtp.server.SMTPServer; //导入方法依赖的package包/类
@PostConstruct
public void startup() {

    smtpServer = new SMTPServer(handlerFactory);
    smtpServer.setSoftwareName(HoldMailSMTPServer.class.getSimpleName() + " SMTP");
    smtpServer.setPort(smtpServerPort);
    smtpServer.start();

}
 
开发者ID:SpartaSystems,项目名称:holdmail,代码行数:10,代码来源:HoldMailSMTPServer.java

示例6: start

import org.subethamail.smtp.server.SMTPServer; //导入方法依赖的package包/类
/**
 * Starts the SMTP server.
 */
@PostConstruct
public void start() throws CarrierConfigurationException {
    configurationLoader.run();

    SMTPServer smtpServer = new SMTPServer(new SimpleMessageListenerAdapter(messageHandler));
    smtpServer.setRequireTLS(serverConfiguration.isTlsForced());
    smtpServer.setPort(serverConfiguration.getPort());

    System.setProperty("mail.debug", "true");
    smtpServer.start();
}
 
开发者ID:stevesoltys,项目名称:carrier,代码行数:15,代码来源:SMTPServerWrapper.java

示例7: testEmailSentOnSendEmailEvent

import org.subethamail.smtp.server.SMTPServer; //导入方法依赖的package包/类
@Test
public void testEmailSentOnSendEmailEvent() throws MessagingException, IOException, InterruptedException {
    SMTPServer smtpServer = new SMTPServer(new SimpleMessageListenerAdapter(this));

    new Wait(new ContextPublishedWaitCondition(bundleContext, "org.motechproject.motech-platform-event"), 5000).start();
    new Wait(new ContextPublishedWaitCondition(bundleContext), 5000).start();

    try {
        smtpServer.setPort(8099);
        smtpServer.start();

        String messageText = "test message";
        String from = "testfromaddress";
        String to = "testtoaddress";
        String subject = "test subject";

        Map<String, Object> values = new HashMap<>();
        values.put("fromAddress", from);
        values.put("toAddress", to);
        values.put("message", messageText);
        values.put("subject", subject);

        eventRelay.sendEventMessage(new MotechEvent(SendEmailConstants.SEND_EMAIL_SUBJECT, values));

        new Wait(lock, this, 100, 60000).start();

        assertTrue("Message not received", messageReceived);
        assertNotNull(receivedMessageText);
        assertEquals(messageText, receivedMessageText.trim());
    } finally {
        smtpServer.stop();
    }
}
 
开发者ID:motech,项目名称:motech,代码行数:34,代码来源:EmailChannelBundleIT.java


注:本文中的org.subethamail.smtp.server.SMTPServer.start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。