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 Discover method from EmailConfigApi class. This method requires 1 parameter — EmailConfigDiscoverRequest, which is a request model for this operation.
EmailConfigDiscoverRequest 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. EmailConfigDiscoverRequest 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.
Discover 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 DiscoverOauth and DiscoverPassword. These methods use all algorithms from Discover 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 DiscoverPassword method. This method requires 1 parameter — EmailConfigDiscoverPasswordRequest, which is a request model for this operation.
EmailConfigDiscoverPasswordRequest 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 DiscoverOauth method. This method requires 1 parameter — EmailConfigDiscoverOauthRequest, which is a request model for this operation.
EmailConfigDiscoverOauthRequest 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: