Package ch.astorm.smtp4j
Class SmtpServerBuilder
java.lang.Object
ch.astorm.smtp4j.SmtpServerBuilder
Helper to build a new
SmtpServer.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds theSmtpServer.start()Builds theSmtpServerand starts it.withListener(SmtpServerListener listener) Adds the specifiedlisteneronce de server is build.withMessageHandler(SmtpMessageHandler messageHandler) Defines theSmtpMessageHandlerto be applied for the received messages.withPort(int port) Defines the port on which theSmtpServerwill listen to.withThreadFactory(ThreadFactory threadFactory) Defines theThreadFactoryto use to handle the SMTP messages.
-
Constructor Details
-
SmtpServerBuilder
public SmtpServerBuilder()
-
-
Method Details
-
withPort
Defines the port on which theSmtpServerwill listen to. If the port is undefined, the server will make a dynamic lookup when it is started.- Parameters:
port- The port.- Returns:
- This builder.
- See Also:
-
withMessageHandler
Defines theSmtpMessageHandlerto be applied for the received messages.- Parameters:
messageHandler- The message handler.- Returns:
- This builder.
- See Also:
-
withThreadFactory
Defines theThreadFactoryto use to handle the SMTP messages.- Parameters:
threadFactory- The thread factory.- Returns:
- This builder.
-
withListener
Adds the specifiedlisteneronce de server is build.- Parameters:
listener- The listener to add.- Returns:
- This builder.
- See Also:
-
build
Builds theSmtpServer.- Returns:
- A new
SmtpServerinstance.
-
start
Builds theSmtpServerand starts it.- Returns:
- A new
SmtpServerinstance. - Throws:
IOException
-