コード例 #1
0
  /**
   * Determines if a message is incoming or outgoing based on the domains available in the
   * configured agent and the sender of the message.
   *
   * @param msg The message that is being processed.
   * @param sender The sender of the message.
   * @return true if the message is determined to be outgoing; false otherwise
   */
  protected boolean isOutgoing(MimeMessage msg, NHINDAddress sender) {
    if (agent.getAgent() == null || agent.getAgent().getDomains() == null) return false;

    // if the sender is not from our domain, then is has to be an incoming message
    if (!sender.isInDomain(agent.getAgent().getDomains())) return false;
    else {
      // depending on the SMTP stack configuration, a message with a sender from our domain
      // may still be an incoming message... check if the message is encrypted
      if (SMIMEStandard.isEncrypted(msg)) {
        return false;
      }
    }

    return true;
  }