本文整理汇总了Java中org.subethamail.smtp.server.SMTPServer类的典型用法代码示例。如果您正苦于以下问题:Java SMTPServer类的具体用法?Java SMTPServer怎么用?Java SMTPServer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SMTPServer类属于org.subethamail.smtp.server包,在下文中一共展示了SMTPServer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: shouldConfigureAuthenticationWhenAuthenticationIsConfiguredProperly
import org.subethamail.smtp.server.SMTPServer; //导入依赖的package包/类
@Test
public void shouldConfigureAuthenticationWhenAuthenticationIsConfiguredProperly(){
final String username = "username";
final String password = "password";
final FakeSmtpConfigurationProperties.Authentication authentication = mock(FakeSmtpConfigurationProperties.Authentication.class);
when(authentication.getUsername()).thenReturn(username);
when(authentication.getPassword()).thenReturn(password);
when(fakeSmtpConfigurationProperties.getAuthentication()).thenReturn(authentication);
final SMTPServer smtpServer = mock(SMTPServer.class);
sut.configure(smtpServer);
ArgumentCaptor<AuthenticationHandlerFactory> argumentCaptor = ArgumentCaptor.forClass(AuthenticationHandlerFactory.class);
verify(smtpServer).setAuthenticationHandlerFactory(argumentCaptor.capture());
AuthenticationHandlerFactory authenticationHandlerFactory = argumentCaptor.getValue();
assertNotNull(authenticationHandlerFactory);
assertThat(authenticationHandlerFactory, instanceOf(EasyAuthenticationHandlerFactory.class));
EasyAuthenticationHandlerFactory easyAuthenticationHandlerFactory = (EasyAuthenticationHandlerFactory)authenticationHandlerFactory;
assertSame(basicUsernamePasswordValidator, easyAuthenticationHandlerFactory.getValidator());
}
开发者ID:gessnerfl,项目名称:fake-smtp-server,代码行数:24,代码来源:SmtpServerConfiguratorTest.java
示例3: 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
示例4: start
import org.subethamail.smtp.server.SMTPServer; //导入依赖的package包/类
/**
*/
@PostConstruct
public void start() throws IOException
{
if (this.smtpServer != null)
throw new IllegalStateException("SMTPServer already running");
log.log(Level.INFO,"Starting SMTP service: {0}:{1}", new Object[]{(this.bindAddress==null ? "*" : this.bindAddress), this.port});
this.smtpServer = new SMTPServer(new SMTPHandler(this));
this.smtpServer.setHideTLS(true);
InetAddress binding = this.getBinding();
if (binding != null)
this.smtpServer.setBindAddress(binding);
this.smtpServer.setPort(this.port);
if (this.hostName != null)
this.smtpServer.setHostName(this.hostName);
this.smtpServer.start();
}
开发者ID:voodoodyne,项目名称:subetha,代码行数:25,代码来源:SMTPService.java
示例5: 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
示例6: 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
示例7: configure
import org.subethamail.smtp.server.SMTPServer; //导入依赖的package包/类
public void configure(SMTPServer smtpServer) {
smtpServer.setPort(fakeSmtpConfigurationProperties.getPort());
smtpServer.setBindAddress(fakeSmtpConfigurationProperties.getBindAddress());
if (fakeSmtpConfigurationProperties.getAuthentication() != null) {
configureAuthentication(smtpServer, fakeSmtpConfigurationProperties.getAuthentication());
}
}
开发者ID:gessnerfl,项目名称:fake-smtp-server,代码行数:8,代码来源:SmtpServerConfigurator.java
示例8: configureAuthentication
import org.subethamail.smtp.server.SMTPServer; //导入依赖的package包/类
private void configureAuthentication(SMTPServer smtpServer, FakeSmtpConfigurationProperties.Authentication authentication) {
if (StringUtils.isEmpty(authentication.getUsername())) {
logger.error("Username is missing; skip configuration of authentication");
} else if (StringUtils.isEmpty(authentication.getPassword())) {
logger.error("Password is missing; skip configuration of authentication");
} else {
logger.info("Setup simple username and password authentication for SMTP server");
smtpServer.setAuthenticationHandlerFactory(new EasyAuthenticationHandlerFactory(basicUsernamePasswordValidator));
}
}
开发者ID:gessnerfl,项目名称:fake-smtp-server,代码行数:11,代码来源:SmtpServerConfigurator.java
示例9: create
import org.subethamail.smtp.server.SMTPServer; //导入依赖的package包/类
@Override
public SmtpServer create() {
SimpleMessageListenerAdapter simpleMessageListenerAdapter = new SimpleMessageListenerAdapter(emailPersister);
SMTPServer smtpServer = new SMTPServer(simpleMessageListenerAdapter);
configurator.configure(smtpServer);
return new SmtpServerImpl(smtpServer);
}
开发者ID:gessnerfl,项目名称:fake-smtp-server,代码行数:8,代码来源:SmtpServerFactoryImpl.java
示例10: shouldConfigureBasicParameters
import org.subethamail.smtp.server.SMTPServer; //导入依赖的package包/类
@Test
public void shouldConfigureBasicParameters(){
final Integer port = 1234;
final InetAddress bindingAddress = mock(InetAddress.class);
when(fakeSmtpConfigurationProperties.getPort()).thenReturn(port);
when(fakeSmtpConfigurationProperties.getBindAddress()).thenReturn(bindingAddress);
final SMTPServer smtpServer = mock(SMTPServer.class);
sut.configure(smtpServer);
verify(smtpServer).setPort(port);
verify(smtpServer).setBindAddress(bindingAddress);
verify(smtpServer, never()).setAuthenticationHandlerFactory(any(AuthenticationHandlerFactory.class));
}
开发者ID:gessnerfl,项目名称:fake-smtp-server,代码行数:16,代码来源:SmtpServerConfiguratorTest.java
示例11: shouldSkipConfigurationOfAuthenticationWhenUsernameIsNull
import org.subethamail.smtp.server.SMTPServer; //导入依赖的package包/类
@Test
public void shouldSkipConfigurationOfAuthenticationWhenUsernameIsNull(){
final String password = "password";
final FakeSmtpConfigurationProperties.Authentication authentication = mock(FakeSmtpConfigurationProperties.Authentication.class);
when(authentication.getUsername()).thenReturn(null);
when(authentication.getPassword()).thenReturn(password);
when(fakeSmtpConfigurationProperties.getAuthentication()).thenReturn(authentication);
final SMTPServer smtpServer = mock(SMTPServer.class);
sut.configure(smtpServer);
verify(smtpServer, never()).setAuthenticationHandlerFactory(any(AuthenticationHandlerFactory.class));
verify(logger).error(startsWith("Username"));
}
开发者ID:gessnerfl,项目名称:fake-smtp-server,代码行数:16,代码来源:SmtpServerConfiguratorTest.java
示例12: shouldSkipConfigurationOfAuthenticationWhenUsernameIsEmptyString
import org.subethamail.smtp.server.SMTPServer; //导入依赖的package包/类
@Test
public void shouldSkipConfigurationOfAuthenticationWhenUsernameIsEmptyString(){
final String password = "password";
final FakeSmtpConfigurationProperties.Authentication authentication = mock(FakeSmtpConfigurationProperties.Authentication.class);
when(authentication.getUsername()).thenReturn("");
when(authentication.getPassword()).thenReturn(password);
when(fakeSmtpConfigurationProperties.getAuthentication()).thenReturn(authentication);
final SMTPServer smtpServer = mock(SMTPServer.class);
sut.configure(smtpServer);
verify(smtpServer, never()).setAuthenticationHandlerFactory(any(AuthenticationHandlerFactory.class));
verify(logger).error(startsWith("Username"));
}
开发者ID:gessnerfl,项目名称:fake-smtp-server,代码行数:16,代码来源:SmtpServerConfiguratorTest.java
示例13: shouldSkipConfigurationOfAuthenticationWhenPasswordIsNull
import org.subethamail.smtp.server.SMTPServer; //导入依赖的package包/类
@Test
public void shouldSkipConfigurationOfAuthenticationWhenPasswordIsNull(){
final String username = "username";
final FakeSmtpConfigurationProperties.Authentication authentication = mock(FakeSmtpConfigurationProperties.Authentication.class);
when(authentication.getUsername()).thenReturn(username);
when(authentication.getPassword()).thenReturn(null);
when(fakeSmtpConfigurationProperties.getAuthentication()).thenReturn(authentication);
final SMTPServer smtpServer = mock(SMTPServer.class);
sut.configure(smtpServer);
verify(smtpServer, never()).setAuthenticationHandlerFactory(any(AuthenticationHandlerFactory.class));
verify(logger).error(startsWith("Password"));
}
开发者ID:gessnerfl,项目名称:fake-smtp-server,代码行数:16,代码来源:SmtpServerConfiguratorTest.java
示例14: shouldSkipConfigurationOfAuthenticationWhenPasswordIsEmptyString
import org.subethamail.smtp.server.SMTPServer; //导入依赖的package包/类
@Test
public void shouldSkipConfigurationOfAuthenticationWhenPasswordIsEmptyString(){
final String username = "username";
final FakeSmtpConfigurationProperties.Authentication authentication = mock(FakeSmtpConfigurationProperties.Authentication.class);
when(authentication.getUsername()).thenReturn(username);
when(authentication.getPassword()).thenReturn("");
when(fakeSmtpConfigurationProperties.getAuthentication()).thenReturn(authentication);
final SMTPServer smtpServer = mock(SMTPServer.class);
sut.configure(smtpServer);
verify(smtpServer, never()).setAuthenticationHandlerFactory(any(AuthenticationHandlerFactory.class));
verify(logger).error(startsWith("Password"));
}
开发者ID:gessnerfl,项目名称:fake-smtp-server,代码行数:16,代码来源:SmtpServerConfiguratorTest.java
示例15: shouldCreateNewInstanceAndDelegateCallsToRealImplementation
import org.subethamail.smtp.server.SMTPServer; //导入依赖的package包/类
@Test
public void shouldCreateNewInstanceAndDelegateCallsToRealImplementation(){
SMTPServer delegate = mock(SMTPServer.class);
SmtpServerImpl sut = new SmtpServerImpl(delegate);
sut.start();
verify(delegate).start();
sut.stop();
verify(delegate).stop();
}
开发者ID:gessnerfl,项目名称:fake-smtp-server,代码行数:13,代码来源:SmtpServerImplTest.java
示例16: 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
示例17: 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
示例18: LoadTester
import org.subethamail.smtp.server.SMTPServer; //导入依赖的package包/类
/** */
public LoadTester(String host, int port) throws Exception
{
this.server = new SMTPServer(new SimpleMessageListenerAdapter(this.listener));
this.server.setPort(port);
this.server.setHostName(host);
}
开发者ID:voodoodyne,项目名称:subetha,代码行数:8,代码来源:LoadTester.java
示例19: getCommandMessage
import org.subethamail.smtp.server.SMTPServer; //导入依赖的package包/类
/** */
private String getCommandMessage(SMTPServer server)
{
return "214-"
+ server.getSoftwareName()
+ " on "
+ server.getHostName()
+ "\r\n"
+ "214-Topics:\r\n"
+ this.getFormattedTopicList(server)
+ "214-For more info use \"HELP <topic>\".\r\n"
+ "214 End of HELP info";
}
开发者ID:voodoodyne,项目名称:subethasmtp,代码行数:14,代码来源:HelpCommand.java
示例20: getFormattedTopicList
import org.subethamail.smtp.server.SMTPServer; //导入依赖的package包/类
/** */
protected String getFormattedTopicList(SMTPServer server)
{
StringBuilder sb = new StringBuilder();
for (String key : server.getCommandHandler().getVerbs())
{
sb.append("214- " + key + "\r\n");
}
return sb.toString();
}
开发者ID:voodoodyne,项目名称:subethasmtp,代码行数:11,代码来源:HelpCommand.java
注:本文中的org.subethamail.smtp.server.SMTPServer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论