Configure Email Server¶
TestGen can be configured to use an email server that implements the Simple Mail Transfer Protocol (SMTP), like Amazon Simple Email Service (SES), Azure Communication Services, or Google Workspace SMTP Relay Service.
This enables users to set up email notifications for profiling runs, test runs, monitor anomalies, and quality scorecards.
Prerequisites¶
- TestGen instance installed using dk-installer.exe, as outlined in Install on Windows, or dk-installer, as outlined in Install on Mac/Linux or Install Enterprise, or with Helm, as outlined in Install on Kubernetes.
- Connection details for an SMTP email server: host, port, sender email address, and the connection security the server expects (see Email server settings).
- A username and password, if the server requires them.
- A client certificate and its private key file, in PEM format, if the server authorizes senders by certificate.
Configure the email server¶
-
Navigate to the directory that contains the
docker-compose.ymlfile for TestGen.- If the instance was installed using dk-installer.exe, the file can be located under "AppData\Local\DataKitchenApps".
- If the instance was installed using dk-installer, the file can be located in the folder from which the Python installer was executed.
-
Add the following lines under the x-common-variables section. Leave out
TG_SMTP_USERNAMEandTG_SMTP_PASSWORDif the server authorizes senders by IP address or by client certificate. -
Optional. To present a client certificate to the server:
-
Add the certificate and key as bind mounts on the engine service.
-
Add the following lines under the x-common-variables section. Leave out
TG_SMTP_CLIENT_KEY_PASSWORDif the key is not encrypted.
-
-
Restart the application.
-
Open the
~/.testgen/config.envfile in a text editor. -
Add the following lines (one variable per line, no quotes). Leave out
TG_SMTP_USERNAMEandTG_SMTP_PASSWORDif the server authorizes senders by IP address or by client certificate. -
Optional. To present a client certificate to the server, add the paths to the certificate and key files. Leave out
TG_SMTP_CLIENT_KEY_PASSWORDif the key is not encrypted. -
Restart the application. Stop the running TestGen process with Ctrl+C in the terminal where it is running, then start it again.
-
Open the
values-tg-app.yamlfile used for the installation. -
Add the following under the testgen section. Leave out
usernameandpasswordif the server authorizes senders by IP address or by client certificate. -
Set the connection security by adding the following at the top level of the file. Leave this out if the server expects
ssl, which is the default. -
Optional. To present a client certificate to the server:
- Store the certificate and key in a secret.
-
Add the following entries to the extraEnv list. Leave out
TG_SMTP_CLIENT_KEY_PASSWORDif the key is not encrypted. -
Mount the secret by adding the following at the top level of the file.
-
Apply the change.
Reference¶
Email server settings¶
| Environment variable | Helm key | Description |
|---|---|---|
TG_SMTP_ENDPOINT |
smtp.endpoint |
Host name of the email server. |
TG_SMTP_PORT |
smtp.port |
Port of the email server. |
TG_SMTP_SECURITY |
(set through extraEnv) |
How the connection is secured: ssl (typically port 465), starttls (typically port 587 or 25), or none for an unencrypted connection. Defaults to ssl. |
TG_SMTP_USERNAME |
smtp.username |
Username for the email server. Set together with the password, or leave both unset for a relay that does not take credentials. |
TG_SMTP_PASSWORD |
smtp.password |
Password for the email server. |
TG_EMAIL_FROM_ADDRESS |
fromAddress |
Sender address for notification emails. |
TG_SMTP_CLIENT_CERT_FILE |
(set through extraEnv) |
Path to a client certificate to present to the server. Set together with the key file. Requires ssl or starttls. |
TG_SMTP_CLIENT_KEY_FILE |
(set through extraEnv) |
Path to the private key for the client certificate. |
TG_SMTP_CLIENT_KEY_PASSWORD |
(set through extraEnv) |
Passphrase for the private key. Required if the key is encrypted. |
Helm keys are under testgen.emailNotifications.
Provider notes¶
- Microsoft 365 and Azure Communication Services accept only STARTTLS, so set
TG_SMTP_SECURITYtostarttls. - Amazon SES and Google Workspace accept both
sslandstarttls, depending on the port. - Microsoft 365 SMTP relay and Direct Send authorize senders without a username and password. A relay connector authorized by static IP address needs no further setup. A connector authorized by certificate requires a certificate from a commercial certificate authority whose Subject or Subject Alternative Name contains a verified accepted domain in the tenant; a self-signed certificate is rejected.