POST api/2.0/mail/accounts This function requires authentication

Description

Creates an account using full information about mail servers specified in the request.

Parameters
Name Description Type Example
name
sent in body
Account name string some text
email
sent in body
Account email address in the name@domain format string some text
account
sent in body
IMAP or POP server login string some text
password
sent in body
IMAP or POP server password string some text
port
sent in body
IMAP or POP server port number 1234
server
sent in body
IMAP or POP server address or IP string some text
smtp_account
sent in body
SMTP server login string some text
smtp_password
sent in body
SMTP server password string some text
smtp_port
sent in body
SMTP server port number 1234
smtp_server
sent in body
SMTP server address or IP string some text
smtp_auth
sent in body
Specifies if the authentication is needed for the SMTP server or not Bool value true
imap
sent in body
Specifies if the IMAP server is used for incoming mails or not Bool value true
restrict
sent in body
Specifies if all the mails should be downloaded from the account (false) or not (true). If true, then messages for the last 30 days only will be imported Bool value true
incoming_encryption_type
sent in body
Encryption type for the IMAP or POP server: 0 - None, 1 - SSL, 2 - StartTLS None, SSL, StartTLS None
outcoming_encryption_type
sent in body
Encryption type for the SMTP server: 0 - None, 1 - SSL, 2 - StartTLS None, SSL, StartTLS None
auth_type_in
sent in body
Authentication type for the IMAP or POP server: 0 - None, 1 - Login, 4 - CramMd5, 5 - OAuth2 None, Login, CramMd5, OAuth2 None
auth_type_smtp
sent in body
Authentication type for the SMTP server: 0 - None, 1 - Login, 4 - CramMd5, 5 - OAuth2 None, Login, CramMd5, OAuth2 None
Example
POST api/2.0/mail/accounts
Host: yourportal.onlyoffice.com
Content-Type: application/json
Accept: application/json

{
  "name": "some text",
  "email": "some text",
  "account": "some text",
  "password": "some text",
  "port": 1234,
  "server": "some text",
  "smtp_account": "some text",
  "smtp_password": "some text",
  "smtp_port": 1234,
  "smtp_server": "some text",
  "smtp_auth": true,
  "imap": true,
  "restrict": true,
  "incoming_encryption_type": "None",
  "outcoming_encryption_type": "None",
  "auth_type_in": "None",
  "auth_type_smtp": "None"
}
Returns

Created account

Example Response

application/json

{
  "status": 0,
  "response": {
    "mailboxId": 12,
    "email": "email@only.com",
    "enabled": true,
    "name": "name",
    "oAuthConnection": true,
    "signature": {
      "mailboxId": "132",
      "html": "html",
      "isActive": true
    },
    "autoreply": {
      "mailboxId": 33,
      "turnOn": true,
      "onlyContacts": false,
      "turnOnToDate": true,
      "fromDate": "2020-10-01T17:04:32.0000000",
      "toDate": "2020-10-01T17:04:32.0000000",
      "subject": "subject",
      "html": "html"
    },
    "eMailInFolder": "eMailInFolder",
    "quotaError": false,
    "authError": false,
    "isGroup": true,
    "isAlias": true,
    "isTeamlabMailbox": true,
    "isDefault": true,
    "isSharedDomainMailbox": true
  }
}

text/xml

<result>
  <status>0</status>
  <response>
    <mailboxId>12</mailboxId>
    <email>email@only.com</email>
    <enabled>True</enabled>
    <name>name</name>
    <oAuthConnection>True</oAuthConnection>
    <signature>
      <mailboxId>132</mailboxId>
      <html>html</html>
      <isActive>True</isActive>
    </signature>
    <autoreply>
      <mailboxId>33</mailboxId>
      <turnOn>True</turnOn>
      <onlyContacts>False</onlyContacts>
      <turnOnToDate>True</turnOnToDate>
      <fromDate>2020-10-01T17:04:32.0000000</fromDate>
      <toDate>2020-10-01T17:04:32.0000000</toDate>
      <subject>subject</subject>
      <html>html</html>
    </autoreply>
    <eMailInFolder>eMailInFolder</eMailInFolder>
    <quotaError>False</quotaError>
    <authError>False</authError>
    <isGroup>True</isGroup>
    <isAlias>True</isAlias>
    <isTeamlabMailbox>True</isTeamlabMailbox>
    <isDefault>True</isDefault>
    <isSharedDomainMailbox>True</isSharedDomainMailbox>
  </response>
</result>