In this section:

Introduction

The SMTP Listener is a custom message listener extension for Parasoft Virtualize. It stands up a temporary SMTP server that notifies Virtualize on a per-message basis allowing users to accept or reject, with a custom rejection message, the incoming message and perform validations and post-processing as needed.

Installation

This tool can be installed from the UI or the command line.

Installing from the UI

  1. Go to Parasoft > Preferences and click System Properties.
  2. Click Add JARs and choose com.virtualize.listener.smtp-<VERSION>.jar.
  3. Click Apply.
  4. Restart Virtualize.

Installing from the Command Line

Add the com.parasoft.virtualize.listener.smtp-<VERSION>.jar file to the system.properties.classpath property in your settings properties file. For example:

system.properties.classpath=<PATH_TO_JAR>/com.parasoft.virtualize.listener.smtp-1.1.0.jar

Usage

You can select and configure the listener in the Virtual Asset configuration panel.

  1. In the Virtualize Server view, choose the virtual asset you want to configure to use with the custom message listener.
  2. Choose Transports > Custom in the Virtual Asset Deployment Settings. If multiple listeners are installed, choose SMTP Listener from the Select Implementation menu.
  3. Configure the connection and security settings (see Configuration).
     
  4. Save your changes.

Messages

For each email that it receives, the SMTP Listener will create three request messages for responders.

One: an XML document detailing who sent the email. This makes it easier to set up responders based on the email's sender. For example:

<SMTP>
 <From>[email protected]</From>
</SMTP> 

Two: an XML document detailing the email's recipients. This makes it easier to set up responders based on the email's recipients. For example:

<SMTP>
 <Recipients>
  <Recipient>[email protected]</Recipient>
 </Recipients>
</SMTP> 

Three: the complete email. For example:

Received: from hostname (localhost [127.0.0.1])
        by hostname
        with SMTP (SubEthaSMTP null) id M4LMIVYQ
        for [email protected];
        Thu, 12 Dec 2024 09:[MASKED]9:22 -0800 (PST)
From: [email protected]
To: [email protected]
Message-ID: <1[MASKED]1973616[MASKED].0.1734026361923.JavaMail.hostname>
Content-Transfer-Encoding: 7bit
Subject: Testing Subject
MIME-Version: 1.0
Content-Type: text/html; charset=us-ascii



This is a Text Message. 

Responders can return a response at any step. Responses are treated as error messages sent back to the client and can be a text message, an error code and a text message, or just an error code.

Error message example:

Transaction failed 

Error message with code:

450: The requested mail action was not taken because the mailbox is unavailable

Configuration

A Literal Message Responder with an empty payload should be configured for the SMTP listener to accept incoming messages.

Listener settings are described below.

Connection Settings

Host Name

Defines the hostname for the SMTP server. If empty, the system default hostname will be used.

PortDefines the port for the SMTP server. If empty, the listener will not start.

Security Settings

User Properties File

Specifies the absolute path to a properties file used to define username and password combinations. The passwords are stored in plain text. The properties file should be configured in the following format:

<username>=<password>

If this field is left empty, user authentication will be disabled.

Enable Transport Layer Security

Enables/disables transport layer security. If set to true, all connections to the server will be encrypted. Enabling TLS requires a properly configured Key Store and Trust Store. The default is false.

Key Store File

Specifies the absolute path to a keystore file. The keystore file must be in a standard format (for example, JKS, PKCS12, and so on). If TLS is enabled and no value is defined, the JVM system property javax.net.ssl.keyStore will be used.

TLS must be enabled for this property to have any effect.

Key Store Type

Defines the type of keystore file supplied in the Key Store File setting. If TLS is enabled and no value is defined, the JVM system property javax.net.ssl.keyStoreType will be used.

TLS must be enabled for this property to have any effect.

Key Store Password

Defines the password for the keystore supplied in the Key Store File setting. If TLS is enabled and no value is defined, the JVM system property javax.net.ssl.keyStorePassword will be used.

TLS must be enabled for this property to have any effect.

Enable Client Authentication

Enables/disables client authentication when TLS is enabled. If set to true, all connections will require the server to authenticate the clients' certificate. The Trust Store File must be properly configured with the client certificate as a “Trusted” certificate. The default is false.

TLS must be enabled for this property to have any effect.

Trust Store File

Specifies the absolute path to the keystore file used for verifying the authenticity (“trust”) of client certificates. The keystore file must be in a standard format (for example, JKS, PKCS12, and so on). If TLS is enabled and no value is defined, the JVM system property javax.net.ssl.trustStore will be used.

TLS must be enabled for this property to have any effect.

Trust Store Type

Defines the type of keystore file supplied in the Trust Store File setting. If TLS is enabled and no value is defined, the JVM system property javax.net.ssl.trustStoreType will be used.

TLS must be enabled for this property to have any effect.

Trust Store Password

Defines the password for the keystore supplied in the Trust Store File setting. If TLS is enabled and no value is defined, the JVM system property javax.net.ssl.trustStorePassword will be used.

TLS must be enabled for this property to have any effect.

Change Log

1.2.1

  • Version adjusted
  • The listener will no longer attempt to start when not configured with a port

1.0

  • Initial release


  • No labels