Class SessionBot

java.lang.Object
com.mimecast.robin.bots.SessionBot
All Implemented Interfaces:
BotProcessor

public class SessionBot extends Object implements BotProcessor
Session bot that replies with SMTP session analysis.

This bot analyzes the complete SMTP session including:

  • Connection information (IP, TLS, authentication)
  • SMTP transaction details
  • Email headers and envelope
  • DNS and infrastructure information

The response is sent as a JSON attachment with a text summary.

Address format supports reply-to sieve parsing:

  • robotSession@example.com - replies to From or envelope sender
  • robotSession+token@example.com - same as above with token
  • robotSession+token+user+domain.com@example.com - replies to user@domain.com

In the sieve format, the reply address is encoded with + instead of @.
Example: robotSession+abc+admin+internal.com@robin.local → replies to admin@internal.com

  • Field Details

    • log

      private static final org.apache.logging.log4j.Logger log
    • GSON

      private static final com.google.gson.Gson GSON
      Gson instance for serializing session data with exclusion strategy.
  • Constructor Details

    • SessionBot

      public SessionBot()
  • Method Details

    • process

      public void process(Connection connection, EmailParser emailParser, String botAddress)
      Processes the session bot request.
      Specified by:
      process in interface BotProcessor
      Parameters:
      connection - SMTP connection.
      emailParser - Parsed email (may be null - bots run async after parser is closed).
      botAddress - The bot address that was matched.
    • createTextSummary

      private String createTextSummary(Session session)
      Creates the text summary for the email body.

      The complete session data will be attached as a JSON file by the queueResponse method.

      Parameters:
      session - Original SMTP session.
      Returns:
      Text summary of the session.
    • queueResponse

      private void queueResponse(Session session, String botAddress, String replyTo)
      Queues the response for delivery.
      Parameters:
      session - Original SMTP session to analyze.
      botAddress - Bot address that received the request.
      replyTo - Recipient address.
    • getName

      public String getName()
      Description copied from interface: BotProcessor
      Gets the name of this bot for factory registration.
      Specified by:
      getName in interface BotProcessor
      Returns:
      Bot name.