public class Wiser extends Object implements SimpleMessageListener
| Modifier and Type | Field and Description |
|---|---|
protected List<WiserMessage> |
messages |
| Constructor and Description |
|---|
Wiser()
Create a new SMTP server with this class as the listener.
|
Wiser(int port)
Convenience constructor
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
accept(String from,
String recipient)
Always accept everything
|
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() |
SMTPServer |
getServer() |
protected javax.mail.Session |
getSession()
Creates the JavaMail Session object for use in WiserMessage
|
static void |
main(String[] args)
A main() for this class.
|
void |
setHostname(String hostname)
The hostname that the server should listen on.
|
void |
setPort(int port)
The port that the server should listen on.
|
void |
start()
Starts the SMTP Server
|
void |
stop()
Stops the SMTP Server
|
protected List<WiserMessage> messages
public Wiser()
public Wiser(int port)
public void setPort(int port)
port - public void setHostname(String hostname)
hostname - public void start()
public void stop()
public static void main(String[] args) throws Exception
Exceptionpublic boolean accept(String from, String recipient)
accept in interface SimpleMessageListenerfrom - 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 SimpleMessageListenerfrom - 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.protected javax.mail.Session getSession()
public List<WiserMessage> getMessages()
public SMTPServer getServer()
public void dumpMessages(PrintStream out) throws javax.mail.MessagingException
javax.mail.MessagingExceptionCopyright © 2006–2021. All rights reserved.