Class SmtpSender

All Implemented Interfaces:
RunningDaemon, TransportSender

public class SmtpSender extends ClientConnection implements TransportSender
  • Constructor Details

    • SmtpSender

      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.

      Parameters:
      senderAddress - the sending email address to be used
      server - the server fully qualified domain name
      port - the server port to send the messages to
      creds - the credentials to be used
      context - the security context to be used
      Throws:
      IOException - if failing to connect to the server
  • Method Details

    • sendMessage

      public void sendMessage(String address, InputStream is) throws IOException
      Description copied from interface: TransportSender

      sends a message on the transport layer.

      This method is called by the blender layer to send a message.

      Specified by:
      sendMessage in interface TransportSender
      Parameters:
      address - the string representation of the target address on the transport layer
      is - the outputstream providing the message
      Throws:
      IOException - if transport layer was unable to satisfy the request
    • shutdownDaemon

      public void shutdownDaemon()
      Description copied from interface: 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().

      Specified by:
      shutdownDaemon in interface RunningDaemon
    • startDaemon

      public void startDaemon()
      Description copied from interface: RunningDaemon

      Initializes and starts all threads required to run the daemon.

      Specified by:
      startDaemon in interface RunningDaemon
    • stopDaemon

      public void stopDaemon()
      Description copied from interface: RunningDaemon

      Stopps all daemon threads and frees all temporary resources.

      Specified by:
      stopDaemon in interface RunningDaemon