Class ProxyBehaviour

java.lang.Object
com.mimecast.robin.smtp.extension.client.DefaultBehaviour
com.mimecast.robin.smtp.extension.client.ProxyBehaviour
All Implemented Interfaces:
Behaviour

public class ProxyBehaviour extends DefaultBehaviour
Proxy client behaviour.

This behaviour is designed for a single envelope proxy connection.

It executes the SMTP exchange up to the MAIL command and then waits for individual RCPT calls before accepting the DATA command.

Unlike DefaultBehaviour, it does NOT automatically execute the data method.

  • Field Details

    • envelope

      MessageEnvelope envelope
      Envelope being proxied.
    • mailSent

      private boolean mailSent
      Flag to track if MAIL FROM was sent.
  • Constructor Details

    • ProxyBehaviour

      public ProxyBehaviour(MessageEnvelope envelope)
      Constructs a new ProxyBehaviour instance.
      Parameters:
      envelope - The envelope to proxy.
  • Method Details

    • process

      public void process(Connection connection) throws IOException
      Executes delivery up to MAIL FROM.

      Does NOT execute DATA - that must be called separately via sendData().

      Specified by:
      process in interface Behaviour
      Overrides:
      process in class DefaultBehaviour
      Parameters:
      connection - Connection instance.
      Throws:
      IOException - Unable to communicate.
    • mail

      void mail() throws IOException
      Executes MAIL FROM.
      Throws:
      IOException - Unable to communicate.
    • sendRcpt

      public String sendRcpt(String recipient) throws IOException
      Sends RCPT TO for a single recipient.

      This is called by ServerRcpt for each matching recipient.

      Parameters:
      recipient - The recipient address.
      Returns:
      The SMTP response from the proxy server.
      Throws:
      IOException - Unable to communicate.
    • sendData

      public boolean sendData() throws IOException
      Sends DATA command and streams the email.

      This is called by ServerData when ready to send the message.

      Returns:
      Boolean indicating success.
      Throws:
      IOException - Unable to communicate.
    • sendQuit

      public void sendQuit() throws IOException
      Sends QUIT command.
      Throws:
      IOException - Unable to communicate.