SMTP Configuration#
The Janssen Server provides multiple configuration tools to perform these tasks.
Use the command line to perform actions from the terminal. Learn how to use Jans CLI here or jump straight to the Using Command Line
Use a fully functional text-based user interface from the terminal. Learn how to use Jans Text-based UI (TUI) here or jump straight to the Using Text-based UI
Use REST API for programmatic access or invoke via tools like CURL or Postman. Learn how to use Janssen Server Config API here or Jump straight to the Using Configuration REST API
Using Command Line#
In the Janssen Server, you can deploy and customize the SMTP using the
command line. To get the details of Janssen command line operations relevant to
SMTP Configuration, you can check the operations under ConfigurationSmtp
task using the command below:
/opt/jans/jans-cli/config-cli.py --info ConfigurationSmtp
Operation ID: get-config-smtp
Description: Returns SMTP server configuration
Operation ID: put-config-smtp
Description: Updates SMTP server configuration
Schema: SmtpConfiguration
Operation ID: post-config-smtp
Description: Adds SMTP server configuration
Schema: SmtpConfiguration
Operation ID: delete-config-smtp
Description: Deletes SMTP server configuration
Operation ID: test-config-smtp
Description: Signing Test SMTP server configuration
Schema: SmtpTest
Find SMTP Server Configuration#
To view the current SMTP server configuration, run the following command line:
/opt/jans/jans-cli/config-cli.py --operation-id get-config-smtp
It will show the SMTP server configuration as below:
Sample Output | |
---|---|
1 2 3 4 5 6 7 8 9 10 |
|
Setup New SMTP Server Configuration#
To add a new SMTP Server, we can use post-config-smtp
operation id.
As shown in the output for--info
command, the post-config-smtp
operation requires data to be sent
according to the SmtpConfiguration
schema.
To see the schema, use the command below:
/opt/jans/jans-cli/config-cli.py --schema SmtpConfiguration
The Janssen Server also provides an example of data that adheres to the above schema. To fetch the example, use the command below.
/opt/jans/jans-cli/config-cli.py --schema-sample SmtpConfiguration
Using the schema and the example above, we have added below data to the file
/tmp/smtp.json
.
Input | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
To setup a new SMTP server configuration, run the following command:
/opt/jans/jans-cli/config-cli.py --operation-id post-config-smtp \
--data /tmp/smtp.json
Sample Output | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
Update SMTP Server Configuration#
To update the SMTP server, we can use the put-config-smtp
operation id.
simply change any information on /tmp/smtp.json
file and run the following
command:
In that file, update the value false
to true
of the trust_host
field.
/opt/jans/jans-cli/config-cli.py --operation-id put-config-smtp \
--data /tmp/smtp.json
Delete SMTP Sever Configuration#
To delete the SMTP Sever, we can use the delete-config-smtp
operation id.
run the following command
/opt/jans/jans-cli/config-cli.py --operation-id delete-config-smtp
Test SMTP Server Configuration#
Testing SMTP Server configuration token with https://jans.io/oauth/config/smtp.write
scope is required. To test the SMTP server configuration update, change any information
on the /tmp/smtp.json
file with test data and run the following command:
/opt/jans/jans-cli/config-cli.py --operation-id test-config-smtp \
--data /tmp/smtp.json
SMTP Password
should be an App password and not a web login password.
Using Text-based UI#
Start TUI using the command below:
sudo /opt/jans/jans-cli/jans_cli_tui.py
SMPT Screen#
Navigate to Auth Server
-> SMPT
to open the SMPT screen as shown
in the image below.
- This screen shows the current SMTP server configuration.
- After changing the SMPT data, update the SMPT server using the
Save
button. - Test the SMPTS server using the
Test
button, and the result will be displayed.
The test result image is shown below.
Using Configuration REST API#
Janssen Server Configuration REST API exposes relevant endpoints for managing and configuring the SMTP. Endpoint details are published in the Swagger document.
Created: 2021-04-22