use of org.subethamail.smtp.auth.PlainAuthenticationHandlerFactory in project vertx-examples by vert-x3.
the class LocalSmtpServer method startWithAuth.
public static void startWithAuth(int port) {
SMTPServer server = new SMTPServer(new SimpleMessageListenerAdapter(new MyMessageListener()));
server.setPort(port);
UsernamePasswordValidator validator = (s, s1) -> {
if (!"username".equalsIgnoreCase(s) || !"password".equalsIgnoreCase(s1)) {
throw new LoginFailedException();
}
};
server.setAuthenticationHandlerFactory(new PlainAuthenticationHandlerFactory(validator));
server.start();
}
Aggregations