Discover Email Configuration

Work With Email Configuration

This is an automated email configuration discovery API. It performs more than 5 different configuration discovery methods simultaneously to support the maximum count of email providers. You can find an email server’s configuration with 3 different methods. 

Discover Without Validation

The simplest way to discover email configuration is calling DiscoverEmailConfig method. This method requires 1 parameter — DiscoverEmailConfigRequest, which is a request model for this operation. 

 DiscoverEmailConfigRequest has 2 parameters:

  • Address — Email address.
  • FastProcessing [optional] — Turns on fast processing. All discover systems will run in parallel. First discovered result will be returned.

How to discover email configuration without validation?


This method performs email configuration discovery using all methods that do not require validation. All methods invoked in parallel and the best result is returned to the user. DiscoverEmailConfigRequest contains one extra field - fastProcessing. This field determines that there is no need for the best possible result. If fastProcessing is set to true, service will also run all discover methods in parallel and return the first successful result without waiting for others.

DiscoverEmailConfig returns list of EmailAccountConfig objects. ExtraInfo field contains extra information like OWA or EWS URLs, enable protocol instructions, etc.

See JSON Response Example For Gmail


{

  "value": [

    {

      "displayName": "Google Mail",

      "protocolType": "IMAP",

      "host": "imap.gmail.com",

      "port": 993,

      "socketType": "SSLAuto",

      "authenticationTypes": [

        "PasswordCleartext",

        "OAuth2"

      ],

      "extraInfo": [

        {

          "name": "Enable: You need to enable IMAP access",

          "value": "https://mail.google.com/mail/?ui=2&shva=1#settings/fwdandpop"

        }

      ],

      "isValidated": false

    },

    {

      "displayName": "Google Mail",

      "protocolType": "SMTP",

      "host": "smtp.gmail.com",

      "port": 465,

      "socketType": "SSLAuto",

      "authenticationTypes": [

        "PasswordCleartext",

        "OAuth2"

      ],

      "extraInfo": [

        {

          "name": "Enable: You need to enable IMAP access",

          "value": "https://mail.google.com/mail/?ui=2&shva=1#settings/fwdandpop"

        }

      ],

      "isValidated": false

    },

    {

      "displayName": "Google Mail",

      "protocolType": "POP3",

      "host": "pop.gmail.com",

      "port": 995,

      "socketType": "SSLAuto",

      "authenticationTypes": [

        "PasswordCleartext",

        "OAuth2"

      ],

      "extraInfo": [

        {

          "name": "Enable: You need to enable IMAP access",

          "value": "https://mail.google.com/mail/?ui=2&shva=1#settings/fwdandpop"

        }

      ],

      "isValidated": false

    }

  ]

}

Discover With Validation

To discover email configuration with validation, use methods DiscoverEmailConfigOauth and DiscoverEmailConfigPassword. These methods use all algorithms from DiscoverEmailConfig and some extra. Also, the discovered configuration will be validated, if it is possible. Service will try to connect to all discovered protocols using provided auth data.

Discover using password

To discover email configuration using password authentication use DiscoverEmailConfigPassword method. This method requires 1 parameter — DiscoverEmailConfigPasswordRequest, which is a request model for this operation. To initialize this object you should define its 1 parameter —  DiscoverEmailConfigPassword.

DiscoverEmailConfigPassword has 4 parameters:

  • Address — Email address.
  • FastProcessing [optional] — Turns on fast processing. All discover systems will run in parallel. First discovered result will be returned.
  • Login — Email account login. If not specified, address used as a login.
  • Password — Email account password. 

How to discover email configuration using the password authentication?


You can also provide login if it is not same as the address.

Discover using OAuth 2.0

To discover email configuration using OAuth 2.0 use DiscoverEmailConfigOauth method. This method requires 1 parameter — DiscoverEmailConfigOauthRequest, which is a request model for this operation. To initialize this object you should define its 1 parameter — DiscoverEmailConfigOauth

DiscoverEmailConfigOauth has 7 parameters:

  • Address — Email address.
  • FastProcessing [optional] — Turns on fast processing. All discover systems will run in parallel. First discovered result will be returned.
  • Login [optional] — Email account login. If not specified, address used as a login.
  • ClientId — OAuth client id.
  • ClientSecret — OAuth client secret.
  • RefreshToken — OAuth refresh token.
  • RequestUrl — The URL to obtain an access token. If not specified, will be discovered from email configuration.

How to discover email configuration using OAuth 2.0 authentication?


Provide login if it is not same as the address. You can also provide requestUrl (an URL to obtain an access token using refresh token). For some servers, requestUrl is discovered automatically.

More Tutorials

See more Aspose Email tutorials: