public class SmtpSender extends ClientConnection implements TransportSender
Constructor and Description |
---|
SmtpSender(String senderAddress,
String server,
int port,
Credentials creds,
SecurityContext context)
Creates an SMTP sending daemon transfering messages to a smart relay.
|
Modifier and Type | Method and Description |
---|---|
void |
sendMessage(String address,
InputStream is)
sends a message on the transport layer.
|
void |
shutdownDaemon()
Shuts this class down.
|
void |
startDaemon()
Initializes and starts all threads required to run the daemon.
|
void |
stopDaemon()
Stopps all daemon threads and frees all temporary resources.
|
shutdown
closeConnection, connect, do_handshake, do_teardown, enlargeApplicationBuffer, enlargeBuffer, enlargePacketBuffer, getDefaultTimeout, getEngine, getHostName, getPort, getProtocol, getSecurityContext, getSocketChannel, getTimeout, handleBufferUnderflow, handleEndOfStream, isShutdown, isTls, read, read, readln, readln, setDefaultTimeout, setEngine, setProtocol, setSecurityContext, setSocketChannel, setTimeout, startTls, startTls, write, write, writeln, writeln
public SmtpSender(String senderAddress, String server, int port, Credentials creds, SecurityContext context) throws IOException
Creates an SMTP sending daemon transfering messages to a smart relay.
senderAddress
- the sending email address to be usedserver
- the server fully qualified domain nameport
- the server port to send the messages tocreds
- the credentials to be usedcontext
- the security context to be usedIOException
- if failing to connect to the serverpublic void sendMessage(String address, InputStream is) throws IOException
TransportSender
sends a message on the transport layer.
This method is called by the blender layer to send a message.
sendMessage
in interface TransportSender
address
- the string representation of the target address on the transport layeris
- the outputstream providing the messageIOException
- if transport layer was unable to satisfy the requestpublic void shutdownDaemon()
RunningDaemon
Shuts this class down.
This frees all resources and ends all threads for an application or layer shutdown. It is not possible to call start() after running shutdown().
shutdownDaemon
in interface RunningDaemon
public void startDaemon()
RunningDaemon
Initializes and starts all threads required to run the daemon.
startDaemon
in interface RunningDaemon
public void stopDaemon()
RunningDaemon
Stopps all daemon threads and frees all temporary resources.
stopDaemon
in interface RunningDaemon
Copyright © 2023. All rights reserved.