public class Wiser extends java.lang.Object implements SimpleMessageListener
Modifier and Type | Field and Description |
---|---|
protected java.util.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(java.lang.String from,
java.lang.String recipient)
Always accept everything
|
void |
deliver(java.lang.String from,
java.lang.String recipient,
java.io.InputStream data)
Cache the messages in memory
|
void |
dumpMessages(java.io.PrintStream out)
For debugging purposes, dumps a rough outline of the messages to the output stream.
|
java.util.List<WiserMessage> |
getMessages() |
SMTPServer |
getServer() |
protected javax.mail.Session |
getSession()
Creates the JavaMail Session object for use in WiserMessage
|
static void |
main(java.lang.String[] args)
A main() for this class.
|
void |
setHostname(java.lang.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 java.util.List<WiserMessage> messages
public Wiser()
public Wiser(int port)
public void setPort(int port)
port
- public void setHostname(java.lang.String hostname)
hostname
- public void start()
public void stop()
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
public boolean accept(java.lang.String from, java.lang.String recipient)
accept
in interface SimpleMessageListener
from
- is a rfc822-compliant email address.recipient
- is a rfc822-compliant email address.public void deliver(java.lang.String from, java.lang.String recipient, java.io.InputStream data) throws TooMuchDataException, java.io.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.java.io.IOException
- if there is an IO error reading the input data.protected javax.mail.Session getSession()
public java.util.List<WiserMessage> getMessages()
public SMTPServer getServer()
public void dumpMessages(java.io.PrintStream out) throws javax.mail.MessagingException
javax.mail.MessagingException
Copyright © 2006–2018. All rights reserved.