Configuring the SMTP Server Using REST API

Learn how to configure an SMTP server using REST API.


Overview

Configuring the SMTP server determines the mail server and account that will be used to generate the global email notifications. Once you add the information, you can test the connection to ensure no additional settings need to be added for the notifications to work.

DryvIQ uses MailKit, which includes a default server certificate validation for a list of commonly used mail servers such as gmail.com, outlook.com, mail.me.com, yahoo.com, and gmx.net.

Untrusted SSL Certificate

Notifications cannot be set up on an SMTP server that has an untrusted SSL certificate. The environment where DryvIQ is running needs to trust the certificate. This can be done by manually trusting the certificate or using a valid self-signed certificate.

 

 

Field Description Required
host This is the fully qualified domain name of the SMTP service. Required
port In most cases, the SMTP service port will be port 587; however, ports 25 or 465 may be utilized but are not preferred. For more information on SMTP ports, see here: https://www.socketlabs.com/blog/what-port-does-smtp-use/  
socketoptions

Add the value that corresponds to the encryption to be used:

  • 0: No SSL or TLS encryption should be used.
  • 1: Allow the mail service to decide which SSL or TLS options to use.
  • 2: The connection should use SSL or TLS encryption immediately.
  • 3: Elevates the connection to use TLS encryption immediately. This is the default option. This setting will also accept -1 as a value. If you are unsure of what option you need, use -1.
  • 4: Elevates the connection to use TLS encryption immediately but only if the server supports STARTTLS extension.

Optional

(If no value is set, -1 will be set.)

from The default sender. If not specified, the username will be used. Required if a username is not provided.
username The STMP server username. This could be your email address depending on the service. Required if your mail server requires authentication.
password The SMTP service password. This could be your email address depending on the service. Required if your mail server requires authentication.
type Should be smtp-configuration.  

Configure the SMTP Server

Execute a PATCH to configure the email handler to receive notifications. This request configuration will persist. To execute a test, which will not persist, see “Sending a Test Email Notification Using REST API.” 

PATCH {{url}}v1/notifications/handlers/email

Example Body

{
  "from": "string",
  "host": "string",
  "links": {
    "{name}": {
      "href": "string",
      "method": "string",
      "title": "string"
    }
  },
  "password": "string",
  "port": 587,
  "socketoptions": -1,
  "type": "smtp-configuration",
  "username": "string"
}