check_smtp_settings

To validate SMTP server settings before applying them to a billing plan, use the account/check_smtp_settings method.

Only top-level users can use this method. Subusers will receive an error.

Endpoint

Copied!
svc=account/check_smtp_settings&params={
    "send_from": <text>,
    "send_to": <text>,
    "smtp_host": <text>,
    "smtp_port": <uint>,
    "smtp_login": <text>,
    "smtp_password": <text>,
    "subject": <text>,
    "body": <text>
}

Parameters

The request must contain the following parameters:

Parameter Description
send_from Sender email address.
send_to Recipient email address for the test message.
smtp_host SMTP server address including protocol (e.g., smtps://smtp.gmail.com or smtp://smtp.example.com).
smtp_port SMTP server port number (e.g., 465 for SMTPS, 587 for SMTP with STARTTLS).
smtp_login Login username for SMTP authentication.
smtp_password Password for SMTP authentication. Instead of this parameter, you can use plan specifying the billing plan name.
plan Name of the billing plan from which to retrieve the saved SMTP password. Instead of this parameter, you can use the smtp_password parameter.
subject Subject line for the test email.
body Body text for the test email.

Examples

Below are the examples of the account/check_smtp_settings requests.

Request with password

Copied!
svc=account/check_smtp_settings&params={
    "send_from": "notifications@example.com",
    "send_to": "admin@example.com",
    "smtp_host": "smtps://smtp.gmail.com",
    "smtp_port": 465,
    "smtp_login": "notifications@example.com",
    "smtp_password": "your_app_password",
    "subject": "Test SMTP Connection",
    "body": "This is a test email to validate SMTP settings."
}

Request with billing plan

Copied!
svc=account/check_smtp_settings&params={
    "send_from": "notifications@example.com"
    "send_to": "admin@example.com",
    "smtp_host": "smtps://smtp.gmail.com"
    "smtp_port": 465, 
    "smtp_login": "notifications@example.com"
    "plan": "my_billing_plan",
    "subject": "Test SMTP Connection",
    "body": "This is a test email to validate SMTP settings." 
    } 

Response

If the request is completed successfully and the test email is sent, the response returns code 250:

Copied!
{
    "code": 250
}

If the request fails, an error code is returned.

Error codes

Error code Description
600 General validation or configuration error. This code may indicate one of the following:
  • Invalid input parameters
  • Neither password nor billing plan was specified
  • Failed to fetch billing account plugin
  • Failed to fetch subaccount plans
  • Specified billing plan not found
  • Failed to get email config plugin
  • Failed to get email service
  • Failed to create email
800 The current user is not a top-level user or is not signed in.
6 Failed to resolve the SMTP server host.
28 Connection timeout. This may occur when an incorrect port is specified.
56 Failed to receive data from the server. This may occur when attempting to connect to an SMTPS server using SMTP protocol.
535 Invalid SMTP credentials (login or password).
555 Incorrectly formatted email address or unrecognized character in the send_from or send_to fields.

If you find a mistake in the text, please select it and press Ctrl+Enter.

Report a mistake

Your message was sent. Thank you!

An error occurred while submitting the form