Import a single mailbox

This request is used for importing messages from a single mailbox to Yandex.Mail for Domain. For the import, you must include:
  • Connection settings for the server source that Yandex.Mail for Domain should use. You can check the validity of the settings using a separate request.

    If the connection cannot be made using the settings you pass, Yandex.Mail for Domain will keep repeating the connection attempt for a long time without returning errors.

  • The username and password of the mailbox to import.
During the import, a new mailbox is created on Yandex.Mail for the domain. This means the username and password must meet the Yandex requirements:
  • The username must:
    • must contain only Latin letters, numbers, dashes, or dots.

    • start with a letter, end with a letter or number, and be no longer than 30 characters.

  • The password must:
    • contain from 6 to 20 characters — Latin letters, numbers, and the symbols “!”, “@”, “#”, “$”, “%”, “^”, “&”, “*”, “(”, “)”, “_”, “-”, “+”, “:”, “;”, “,”, “.”

    • be different from the username.

If the username or password on the server source does not meet the Yandex requirements, you should specify a new one.
  1. Request syntax
  2. Request example
  3. Response structure

Request syntax

The request should be sent over the HTTPS protocol using the POST method.

POST /api2/admin/import/start_one_import
Host: pddimp.yandex.ru
PddToken: <PDD token>
...

domain=<mail domain name>
&method=<server protocol>
&server=<server name>
&port=<server port>
&ssl=<SSL usage>
&ext-login=<username on source server>
&ext-passwd=<password on source server>
[&int-login=<username for Yandex.Mail for Domain>]
[&int-passwd=<password for Yandex.Mail for Domain>]

Headers:

Name Description
PddToken

PDD token.

Name Description
PddToken

PDD token.

Parameters:

Parameter Type Value
Mandatory
domain String

Name of the mail domain.

server String

Server's domain name or IP address.

port Integer

Server port.

method String

Server protocol.

Possible values:
  • imap

  • imap4

  • pop

  • pop3

ssl String

Use of SSL.

Possible values:
  • yes — SSL connection required.
  • no — SSL should not be used.
ext-login String

Username on the server source.

ext-passwd String

Password on the server source.

Optional
int-login String

Username for authenticating on Yandex.Mail for Domain.

The parameter should be passesd if the ext-login username does not meet Yandex requirements:
  • must contain only Latin letters, numbers, dashes, or dots.

  • start with a letter, end with a letter or number, and be no longer than 30 characters.

int-passwd String

Password for authenticating on Yandex.Mail for Domain.

The parameter should be passesd if the ext-passwd password does not meet Yandex requirements:
  • contain from 6 to 20 characters — Latin letters, numbers, and the symbols “!”, “@”, “#”, “$”, “%”, “^”, “&”, “*”, “(”, “)”, “_”, “-”, “+”, “:”, “;”, “,”, “.”

  • be different from the username.

Parameter Type Value
Mandatory
domain String

Name of the mail domain.

server String

Server's domain name or IP address.

port Integer

Server port.

method String

Server protocol.

Possible values:
  • imap

  • imap4

  • pop

  • pop3

ssl String

Use of SSL.

Possible values:
  • yes — SSL connection required.
  • no — SSL should not be used.
ext-login String

Username on the server source.

ext-passwd String

Password on the server source.

Optional
int-login String

Username for authenticating on Yandex.Mail for Domain.

The parameter should be passesd if the ext-login username does not meet Yandex requirements:
  • must contain only Latin letters, numbers, dashes, or dots.

  • start with a letter, end with a letter or number, and be no longer than 30 characters.

int-passwd String

Password for authenticating on Yandex.Mail for Domain.

The parameter should be passesd if the ext-passwd password does not meet Yandex requirements:
  • contain from 6 to 20 characters — Latin letters, numbers, and the symbols “!”, “@”, “#”, “$”, “%”, “^”, “&”, “*”, “(”, “)”, “_”, “-”, “+”, “:”, “;”, “,”, “.”

  • be different from the username.

Request example

POST  /api2/admin/import/start_one_import HTTP/1.1
Host: pddimp.yandex.ru
PddToken: 123456789ABCDEF0000000000000000000000000000000000000
...
domain=domain.com&method=pop3&server=pop.yandex.ru&port=110&ssl=no&ext-login=111&ext-passwd=my&int-login=s123456789a&int-passwd=1234567890
cURL
curl -H 'PddToken: 123456789ABCDEF0000000000000000000000000000000000000' -d 'domain=domain.com&method=pop3&server=pop.yandex.ru&port=110&ssl=no&ext-login=111&ext-passwd=my&int-login=s123456789a&int-passwd=1234567890' 'https://pddimp.yandex.ru/api2/admin/import/start_one_import'

Response structure

{
  "domain": "{mail domain name}",
  "settings":
    {
      "method": "{server protocol}",
      "server": "{server name}",
      "port": "{server port}",
      "ssl": "{SSL usage}"
    },
  "import_list":
  [
    "external_login": "{username on source server}",
    "external_password": "{password on source server}",
    "internal_login": "{username on Yandex.Mail for Domain}",
    "internal_password": "{password on Yandex.Mail for Domain}",
    "started": "{ready to start import}"
  ]
  "success": "{status of request execution}"
}
Name Type of value Description
domain String

Name of the domain.

settings Object

Server source settings.

import_list Array

Authentication data.

success String

Status of request execution.

Possible values:
  • ok — Request executed successfully.
  • error — Request executed with error.
error String

Error code.

Included in the response if the request resulted in an error.

Possible values:
  • unknown — A temporary failure or API error occurred (repeat the request again later).
  • no_token (no_domain, no_ip ) — A mandatory parameter was omitted.
  • bad_domain — The domain name was not specified or does not conform to the RFC.
  • prohibited — A forbidden domain name.
  • bad_token (bad_login, bad_passwd) — An invalid PDD token (or username/password) was passed.
  • no_auth — The PddToken header was omitted.
  • not_allowed — This operation is not allowed for this user (the user is not the domain administrator).
  • blocked — Blocked domain (for example, due to spam and so on).
  • occupied — The domain name is in use by another user.
  • domain_limit_reached — Exceeded the acceptable number of connected domains (50).
  • no_reply — Yandex.Mail for Domain cannot connect to the server source for the import.
Keys for the settings object
method String

Server protocol.

Possible values:
  • imap

  • imap4

  • pop

  • pop3

server String

Server's domain name or IP address.

port Integer

Server port.

ssl String

Use of SSL.

Possible values:
  • yes — SSL connection required.
  • no — SSL should not be used.
Keys for the import_list array
external_login String

Username on the server source.

external_password String

Password on the server source.

internal_login String

Username for authenticating on Yandex.Mail for Domain.

internal_password String

Password for authenticating on Yandex.Mail for Domain.

started String

Ready to start importing.

Possible values:
  • yes — Import will be launched (all parameters are valid).
  • no — Import will not be launched (an error was detected and the code is indicated in the value of the error key).
Name Type of value Description
domain String

Name of the domain.

settings Object

Server source settings.

import_list Array

Authentication data.

success String

Status of request execution.

Possible values:
  • ok — Request executed successfully.
  • error — Request executed with error.
error String

Error code.

Included in the response if the request resulted in an error.

Possible values:
  • unknown — A temporary failure or API error occurred (repeat the request again later).
  • no_token (no_domain, no_ip ) — A mandatory parameter was omitted.
  • bad_domain — The domain name was not specified or does not conform to the RFC.
  • prohibited — A forbidden domain name.
  • bad_token (bad_login, bad_passwd) — An invalid PDD token (or username/password) was passed.
  • no_auth — The PddToken header was omitted.
  • not_allowed — This operation is not allowed for this user (the user is not the domain administrator).
  • blocked — Blocked domain (for example, due to spam and so on).
  • occupied — The domain name is in use by another user.
  • domain_limit_reached — Exceeded the acceptable number of connected domains (50).
  • no_reply — Yandex.Mail for Domain cannot connect to the server source for the import.
Keys for the settings object
method String

Server protocol.

Possible values:
  • imap

  • imap4

  • pop

  • pop3

server String

Server's domain name or IP address.

port Integer

Server port.

ssl String

Use of SSL.

Possible values:
  • yes — SSL connection required.
  • no — SSL should not be used.
Keys for the import_list array
external_login String

Username on the server source.

external_password String

Password on the server source.

internal_login String

Username for authenticating on Yandex.Mail for Domain.

internal_password String

Password for authenticating on Yandex.Mail for Domain.

started String

Ready to start importing.

Possible values:
  • yes — Import will be launched (all parameters are valid).
  • no — Import will not be launched (an error was detected and the code is indicated in the value of the error key).