Package ch.astorm.smtp4j
Class SmtpServerBuilder
- java.lang.Object
-
- ch.astorm.smtp4j.SmtpServerBuilder
-
public class SmtpServerBuilder extends java.lang.ObjectHelper to build a newSmtpServer.
-
-
Constructor Summary
Constructors Constructor Description SmtpServerBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SmtpServerbuild()Builds theSmtpServer.SmtpServerstart()Builds theSmtpServerand starts it.SmtpServerBuilderwithMessageHandler(SmtpMessageHandler messageHandler)Defines theSmtpMessageHandlerto be applied for the received messages.SmtpServerBuilderwithPort(int port)Defines the port on which theSmtpServerwill listen to.
-
-
-
Method Detail
-
withPort
public SmtpServerBuilder withPort(int port)
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:
SmtpServer(int)
-
withMessageHandler
public SmtpServerBuilder withMessageHandler(SmtpMessageHandler messageHandler)
Defines theSmtpMessageHandlerto be applied for the received messages.- Parameters:
messageHandler- The message handler.- Returns:
- This builder.
- See Also:
SmtpServer.setMessageHandler(ch.astorm.smtp4j.core.SmtpMessageHandler)
-
build
public SmtpServer build()
Builds theSmtpServer.- Returns:
- A new
SmtpServerinstance.
-
start
public SmtpServer start() throws java.io.IOException
Builds theSmtpServerand starts it.- Returns:
- A new
SmtpServerinstance. - Throws:
java.io.IOException
-
-