Fortinet black logo

REST API Solution Guide

Email servers (/smtpservers/)

Email servers (/smtpservers/)

URL: https://[server_name]/api/[api_version]/smtpservers/

This endpoint is used to set up email servers and senders.

Supported fields

Field Display name Type Required Other restrictions
name SMTP server name string Yes Must be unique.
address SMTP server IP address or SMTP server string Yes Must be unique.
port SMTP server port integer No Default is 25 when not specified.
sender_name Sender name for email "from" field string No
sender_email Sender email for email "from" field string Yes
secure Secured communication method string No Either "none" for no encryption or "starttls" for STARTTLS encryption. Default is "none" when not specified.
authentication Use authentication boolean No Default is disabled when not specified. When disabled, authentication name and password are set to None.
authentication_name Authentication username string No Required if "authentication" is enabled.
authentication_password Authentication password string No Required if "authentication" is enabled.
default Default SMTP server boolean No Default is "disable". Only one SMTP server can be the default. Setting to "enable" for an SMTP server will cause this server to be the default. Setting to false will cause the server with ID 1 to become the default.

Allowed methods

HTTP method Resource URI Action
GET /api/v1/smtpservers/ Get all SMTP servers.
GET /api/v1/smtpservers/[id]/ Get a specific SMTP server with ID.
POST /api/v1/smtpservers/ Create a new SMTP server.
PATCH /api/v1/smtpservers/[id]/ Update specified fields of an existing SMTP server with ID.
DELETE /api/v1/smtpservers/[id]/ Delete an SMTP server.

Examples

Get all servers: curl -k -v \ -u "webadmin:[hash]" \ https://[FAC_IP]/api/v1/smtpservers/

Post a server:

curl -k -X POST \

https://[FAC_IP]/api/v1/smtpservers/ \

-H 'Content-Type: application/json' \

-u "webadmin"[hash]" \

-d '{

"address": "mail.server-test.com",

"authentication" true,

"authentication_name": "username",

"authentication_password": "supersecretpassword",

"default": true,

"name": "fortitest25",

"secure": "starttls",

"sender_email": "email@fortinet.com",

"sender_name": "email_sender name",

}'

Email servers (/smtpservers/)

URL: https://[server_name]/api/[api_version]/smtpservers/

This endpoint is used to set up email servers and senders.

Supported fields

Field Display name Type Required Other restrictions
name SMTP server name string Yes Must be unique.
address SMTP server IP address or SMTP server string Yes Must be unique.
port SMTP server port integer No Default is 25 when not specified.
sender_name Sender name for email "from" field string No
sender_email Sender email for email "from" field string Yes
secure Secured communication method string No Either "none" for no encryption or "starttls" for STARTTLS encryption. Default is "none" when not specified.
authentication Use authentication boolean No Default is disabled when not specified. When disabled, authentication name and password are set to None.
authentication_name Authentication username string No Required if "authentication" is enabled.
authentication_password Authentication password string No Required if "authentication" is enabled.
default Default SMTP server boolean No Default is "disable". Only one SMTP server can be the default. Setting to "enable" for an SMTP server will cause this server to be the default. Setting to false will cause the server with ID 1 to become the default.

Allowed methods

HTTP method Resource URI Action
GET /api/v1/smtpservers/ Get all SMTP servers.
GET /api/v1/smtpservers/[id]/ Get a specific SMTP server with ID.
POST /api/v1/smtpservers/ Create a new SMTP server.
PATCH /api/v1/smtpservers/[id]/ Update specified fields of an existing SMTP server with ID.
DELETE /api/v1/smtpservers/[id]/ Delete an SMTP server.

Examples

Get all servers: curl -k -v \ -u "webadmin:[hash]" \ https://[FAC_IP]/api/v1/smtpservers/

Post a server:

curl -k -X POST \

https://[FAC_IP]/api/v1/smtpservers/ \

-H 'Content-Type: application/json' \

-u "webadmin"[hash]" \

-d '{

"address": "mail.server-test.com",

"authentication" true,

"authentication_name": "username",

"authentication_password": "supersecretpassword",

"default": true,

"name": "fortitest25",

"secure": "starttls",

"sender_email": "email@fortinet.com",

"sender_name": "email_sender name",

}'