public final class Wiser extends Object implements SimpleMessageListener
Modifier and Type | Class and Description |
---|---|
static interface |
Wiser.Accepter |
static class |
Wiser.WiserBuilder |
Modifier and Type | Method and Description |
---|---|
boolean |
accept(String from,
String recipient)
Always accept everything
|
static Wiser.WiserBuilder |
accepter(Wiser.Accepter accepter) |
static Wiser |
create() |
static Wiser |
create(SMTPServer.Builder builder) |
void |
deliver(String from,
String recipient,
InputStream data)
Cache the messages in memory
|
void |
dumpMessages(PrintStream out)
For debugging purposes, dumps a rough outline of the messages to the
output stream.
|
List<WiserMessage> |
getMessages()
Returns the list of WiserMessages.
|
SMTPServer |
getServer() |
static void |
main(String[] args)
A main() for this class.
|
static Wiser |
port(int port) |
void |
start()
Starts the SMTP Server
|
void |
stop()
Stops the SMTP Server
|
public static Wiser port(int port)
public static Wiser create(SMTPServer.Builder builder)
public static Wiser create()
public static Wiser.WiserBuilder accepter(Wiser.Accepter accepter)
public void start()
public void stop()
public boolean accept(String from, String recipient)
accept
in interface SimpleMessageListener
from
- is a rfc822-compliant email address.recipient
- is a rfc822-compliant email address.public void deliver(String from, String recipient, InputStream data) throws TooMuchDataException, IOException
deliver
in interface SimpleMessageListener
from
- is the envelope sender in rfc822 formrecipient
- will be an accepted recipient in rfc822 formdata
- will be the smtp data stream, stripped of any extra '.' chars. The
data stream is only valid for the duration of this call.TooMuchDataException
- if the listener can't handle that much data.
An error will be reported to the client.IOException
- if there is an IO error reading the input data.public List<WiserMessage> getMessages()
The number of mail transactions and the number of mails may be different. If a message is received with multiple recipients in a single mail transaction, then the list will contain more WiserMessage instances, one for each recipient.
public SMTPServer getServer()
public void dumpMessages(PrintStream out) throws javax.mail.MessagingException
javax.mail.MessagingException
Copyright © 2006–2020. All rights reserved.