Class Autoconf
java.lang.Object
net.mailific.mailificserverspringboot.Autoconf
Provides Spring autoconfiguration for the Mailific SMTP listener library.
- Author:
- jhumphreys
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionProvides the domain to be advertised in the Banner (connect response).commandHandlerProvider(BannerDomainProvider domain, EhloGreetingProvider greeting, MailObjectFactory mailObjectFactory) Provides a connect handler and collection of command handlers.Provides the EHLO greeting text.extensionProvider(String certPath) Provides a list of extensions for the server to support.Builds an SmtpCommandMap from a CommandHandlerProvider .Provides a factory forMailObjectobjects.serverConfig(String listenHost, int listenPort, String certPath, String certKeyPath, String certPass, SmtpSessionFactory sessionFactory) Provides the ServerConfig used bysmtpServer(ServerConfig)smtpServer(ServerConfig config) Provides a Netty-based SmtpServer.smtpSesssionFactory(LineConsumer commandConsumer, ExtensionProvider extensions) Provides an SmtpSessionFactory.
-
Constructor Details
-
Autoconf
public Autoconf()
-
-
Method Details
-
smtpServer
Provides a Netty-based SmtpServer.- Parameters:
config- SeeserverConfig(String, int, String, String, String, SmtpSessionFactory)
-
serverConfig
@Bean @ConditionalOnMissingBean public ServerConfig serverConfig(@Value("${mailific.server.listenHost:localhost}") String listenHost, @Value("${mailific.server.listenPort:2525}") int listenPort, @Value("${mailific.server.certPath:}") String certPath, @Value("${mailific.server.certKeyPath:}") String certKeyPath, @Value("${mailific.server.certPassword:#{NULL}}") String certPass, SmtpSessionFactory sessionFactory) Provides the ServerConfig used bysmtpServer(ServerConfig)- Parameters:
listenHost- Hostname to listen to. Taken from the property mailific.server.listenHost. The property defaults to "localhost".listenPort- Port to listen on. Taken from the property mailific.server.listenPort. The property defaults to 2525.certPath- File path to an SSL cert-chain file, in PEM format. If set to empty or null, the server won't offer STARTTLS. Taken from the property mailific.server.certPath. The property defaults to empty.certKeyPath- File path to the key (in PKCS8 format) for the SSL cert. Taken from the property mailific.server.certKeyPath. The poperty defaults to empty.certPass- Password for the key specified by certKeyPath. Leave null if the key file is not encrypted. Taken from the property mailific.server.certPassword. Defaults to null.sessionFactory- seesmtpSesssionFactory(LineConsumer, ExtensionProvider)
-
smtpSesssionFactory
@Bean @ConditionalOnMissingBean public SmtpSessionFactory smtpSesssionFactory(@Qualifier("mailificCommandConsumer") LineConsumer commandConsumer, ExtensionProvider extensions) Provides an SmtpSessionFactory. Used byserverConfig(String, int, String, String, String, SmtpSessionFactory)- Parameters:
commandConsumer- seemailificCommandConsumer(CommandHandlerProvider)extensions- seeextensionProvider(String)
-
extensionProvider
@Bean @ConditionalOnMissingBean public ExtensionProvider extensionProvider(@Value("${mailific.server.certPath:}") String certPath) Provides a list of extensions for the server to support. Used bysmtpSesssionFactory(LineConsumer, ExtensionProvider).- Parameters:
certPath- If nonnull and nonblank, the return value will include the STARTTLS extension. Taken from the property mailific.server.certPath. The property defaults to empty.
-
mailificCommandConsumer
@Bean @ConditionalOnMissingBean(name="mailificCommandConsumer") public SmtpCommandMap mailificCommandConsumer(CommandHandlerProvider commands) Builds an SmtpCommandMap from a CommandHandlerProvider . This is the default implementation for the LineConsumer used bysmtpSesssionFactory(LineConsumer, ExtensionProvider).This Bean is named "mailificCommandConsumer" so that it can be distinguished from other possible LineConsumer Beans.
- Parameters:
commands- seecommandHandlerProvider(BannerDomainProvider, EhloGreetingProvider, MailObjectFactory)
-
commandHandlerProvider
@Bean @ConditionalOnMissingBean public CommandHandlerProvider commandHandlerProvider(BannerDomainProvider domain, EhloGreetingProvider greeting, MailObjectFactory mailObjectFactory) Provides a connect handler and collection of command handlers. Used bymailificCommandConsumer(CommandHandlerProvider).- Parameters:
domain- Domain to be used in the Banner and EHLO responses. SeebannerDomainProvider()greeting- Greeting text to be used in EHLO response. SeeehloGreetingProvider()mailObjectFactory- seemailObjectFactory()
-
mailObjectFactory
Provides a factory forMailObjectobjects. You will almost certainly need to provide your own implementation here. Used bycommandHandlerProvider(BannerDomainProvider, EhloGreetingProvider, MailObjectFactory) -
bannerDomainProvider
Provides the domain to be advertised in the Banner (connect response). Also used in the EHLO response. Used bycommandHandlerProvider(BannerDomainProvider, EhloGreetingProvider, MailObjectFactory) -
ehloGreetingProvider
Provides the EHLO greeting text. Maybe return null. Used bycommandHandlerProvider(BannerDomainProvider, EhloGreetingProvider, MailObjectFactory)
-