---
title: Configuring the SMTP server
description: The PingDirectory server supports SSL, StartTLS, and simple SMTP server connections. For SSL and StartTLS connections, you can authenticate using a username and password or a bearer token.
component: pingdirectory
version: 11.1
page_id: pingdirectory:pingdirectory_server_administration_guide:pd_ds_config_smtp_server
canonical_url: https://docs.pingidentity.com/pingdirectory/11.1/pingdirectory_server_administration_guide/pd_ds_config_smtp_server.html
llms_txt: https://docs.pingidentity.com/pingdirectory/llms.txt
docs_for_agents: https://developer.pingidentity.com/build-with-ai/docs-for-agents.md
revdate: June 17, 2026
page_aliases: ["pd_ds_config_ssl_connection_smtp_server.adoc", "pd_ds_config_starttls_connection_smtp_server.adoc"]
section_ids:
  ssl-connection: SSL connection
  steps: Steps
  example: Example:
  ssl-connection-using-oauth: SSL connection using OAuth
  before-you-begin: Before you begin
  steps-2: Steps
  example-2: Example:
  starttls-connection: StartTLS connection
  steps-3: Steps
  example-3: Example:
  starttls-connection-using-oauth: StartTLS connection using OAuth
  before-you-begin-2: Before you begin
  steps-4: Steps
  example-4: Example:
  simple-connection: Simple connection
  steps-5: Steps
  example-5: Example:
  setting-the-smtp-server: Setting the SMTP server
  steps-6: Steps
  example-6: Example:
---

# Configuring the SMTP server

The PingDirectory server supports SSL, StartTLS, and simple SMTP server connections. For SSL and StartTLS connections, you can authenticate using a username and password or a bearer token.

After configuring your connection type, register the server in the [Setting the SMTP server](#setting-the-smtp-server) section.

## SSL connection

### Steps

* To create an external SMTP server using SSL, run the `dsconfig` command.

  #### Example:

  ```shell
  $ bin/dsconfig create-external-server \
    --server-name ssl.smtp.example.com \
    --type smtp \
    --set server-host-name:smtp.gmail.com \
    --set server-port:465 \
    --set smtp-security:ssl \
    --set "user-name:my.name@example.com" \
    --set password:xxxxxx \
    --set "smtp-timeout:10s"
  ```

## SSL connection using OAuth

### Before you begin

Configure a bearer token HTTP authorization method. Learn more in [Configuring bearer token authentication for SMTP](pd_ds_oauth_smtp.html).

### Steps

* To create an external SMTP server using SSL and bearer token authentication, run the `dsconfig` command.

  #### Example:

  ```shell
  $ bin/dsconfig create-external-server \
    --server-name ssl.smtp.example.com \
    --type smtp \
    --set server-host-name:smtp.office365.com \
    --set server-port:465 \
    --set smtp-security:ssl \
    --set "user-name:my.name@example.com" \
    --set "token-acquisition-method:SMTP Bearer Token"
  ```

## StartTLS connection

### Steps

* To configure a StartTLS connection to the server, use the `dsconfig` command.

  #### Example:

  ```shell
  $ bin/dsconfig create-external-server \
    --server-name myTLSServer \
    --type smtp \
    --set server-host-name:tls.smtp.example.com \
    --set server-port:587 \
    --set smtp-security:starttls \
    --set user-name:MyAccountName \
    --set password:AAD5yZ+DjvwiYkBSMer6GQ6B3szQ6gSSBjA=
  ```

## StartTLS connection using OAuth

### Before you begin

Configure a bearer token HTTP authorization method. Learn more in [Configuring bearer token authentication for SMTP](pd_ds_oauth_smtp.html).

### Steps

* To configure a StartTLS connection to the server with bearer token authentication, use the `dsconfig` command.

  #### Example:

  ```shell
  $ bin/dsconfig create-external-server \
    --server-name myTLSServer \
    --type smtp \
    --set server-host-name:smtp.office365.com \
    --set server-port:587 \
    --set smtp-security:starttls \
    --set "user-name:my.name@example.com" \
    --set "token-acquisition-method:SMTP Bearer Token"
  ```

## Simple connection

### Steps

* To configure a simple mail server, use the `dsconfig` command.

  #### Example:

  ```shell
  $ bin/dsconfig create-external-server --server-name smtp1 \
    --type smtp --set server-host-name:smtp.example.com
  ```

## Setting the SMTP server

After creating the SMTP external server, register it in the global configuration.

### Steps

* To register the SMTP server, use the `dsconfig` command.

  #### Example:

  ```shell
  $ bin/dsconfig set-global-configuration-prop \
    --set smtp-server:smtp1
  ```

  This command adds the server to the global list of mail servers that the PingDirectory server can use.
