Search code examples
smtpemail-spammail-server

Plugin-enabled SMTP-Server to add filter-functionality


A few days ago, an idea came to my mind regarding a spam-protection technology.

Therefore, I'm in search of an SMTP-server, which is able to be enhanced by filter plugins.

Is anybody aware of an SMTP framework or a SMTP-server, which provides an API for plugins?

I already stumbled upon Apache's james Project, which at least seems to provide a rich set of email-related modules.


Solution

  • I switched to subethasmtp some days ago and belive that its api support what you are searching for.

    You can implement some Handlers, to deal with mails.

    final MessageHandlerFactory mhf = new MessageHandlerFactory() {
    
                @Override
                public MessageHandler create(final MessageContext ctx) {
                    return new MessageHandler() {
    
                        @Override
                        public void recipient(final String recipient) throws RejectException {
                            // TODO Auto-generated method stub
                        }
    
                        @Override
                        public void from(final String from) throws RejectException {
                            // TODO Auto-generated method stub
                        }
    
                        @Override
                        public void done() {
                            // TODO Auto-generated method stub
                        }
    
                        @Override
                        public void data(final InputStream data) throws RejectException, TooMuchDataException, IOException {
                        }
                    };
                }
            };
            final SMTPServer srv = new SMTPServer(mhf);
            srv.start();