本文整理汇总了Java中org.subethamail.smtp.helper.SimpleMessageListenerAdapter类的典型用法代码示例。如果您正苦于以下问题:Java SimpleMessageListenerAdapter类的具体用法?Java SimpleMessageListenerAdapter怎么用?Java SimpleMessageListenerAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SimpleMessageListenerAdapter类属于org.subethamail.smtp.helper包,在下文中一共展示了SimpleMessageListenerAdapter类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import org.subethamail.smtp.helper.SimpleMessageListenerAdapter; //导入依赖的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());
}
}
}
示例2: create
import org.subethamail.smtp.helper.SimpleMessageListenerAdapter; //导入依赖的package包/类
@Override
public SmtpServer create() {
SimpleMessageListenerAdapter simpleMessageListenerAdapter = new SimpleMessageListenerAdapter(emailPersister);
SMTPServer smtpServer = new SMTPServer(simpleMessageListenerAdapter);
configurator.configure(smtpServer);
return new SmtpServerImpl(smtpServer);
}
示例3: start
import org.subethamail.smtp.helper.SimpleMessageListenerAdapter; //导入依赖的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();
}
示例4: LoadTester
import org.subethamail.smtp.helper.SimpleMessageListenerAdapter; //导入依赖的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);
}
示例5: testEmailSentOnSendEmailEvent
import org.subethamail.smtp.helper.SimpleMessageListenerAdapter; //导入依赖的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();
}
}
示例6: IrisServer
import org.subethamail.smtp.helper.SimpleMessageListenerAdapter; //导入依赖的package包/类
private IrisServer() {
server = new SMTPServer(new SimpleMessageListenerAdapter(this));
mailboxes = new ConcurrentHashMap<String, IrisMailbox>();
IrisMailbox allMail = new IrisMailbox(ALLMAIL_MAILBOX_NAME);
mailboxes.put(allMail.getMailboxName(), allMail);
}
示例7: SMTPServerHandler
import org.subethamail.smtp.helper.SimpleMessageListenerAdapter; //导入依赖的package包/类
/**
* Instantiates a new SMTP server handler.
*
* @param mailListener
* the mail listener
* @param smtpAuthHandlerFactory
* the smtp auth handler factory
*/
public SMTPServerHandler(final SimpleMessageListener mailListener,
final AuthenticationHandlerFactory smtpAuthHandlerFactory) {
smtpServer = new SMTPServer(new SimpleMessageListenerAdapter(mailListener), smtpAuthHandlerFactory);
}
示例8: Wiser
import org.subethamail.smtp.helper.SimpleMessageListenerAdapter; //导入依赖的package包/类
/**
* Create a new SMTP server with this class as the listener.
* The default port is 25. Call setPort()/setHostname() before
* calling start().
*/
public Wiser()
{
this.server = new SMTPServer(new SimpleMessageListenerAdapter(this));
}