> For the complete documentation index, see [llms.txt](https://docs.mikopbx.com/mikopbx/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mikopbx.com/mikopbx/manual/system/mail-settings/yandex-oauth2.md).

# Настройка Yandex Mail (oAuth2)

Настройка почты для сервиса Yandex Mail через oAuth2 авторизацию

### Создание приложения в Yandex

1. Авторизуйтесь в Ваш аккаунт Яндекс и далее перейдите на [страницу создания приложения](https://oauth.yandex.ru/client/new/). Нажмите "**Создать**".

<figure><img src="https://3704471835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPK4TuzRBnP7rt8htho-887967055%2Fuploads%2FKdawJbsc8niP9ShZxUKU%2FYandexOAuthDashboard.png?alt=media&amp;token=1f82f557-061e-4997-9cf1-d6b0d990a685" alt=""><figcaption><p>Главная страница приложений Яндекс ID | OAuth</p></figcaption></figure>

2. В диалоговом окне выберите опцию "**Для атворизации пользователей**". Нажмите "**Перейти к созданию**".

<figure><img src="https://3704471835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPK4TuzRBnP7rt8htho-887967055%2Fuploads%2FD5rQN3gRYzrcgLPKKJRP%2FYandexChoosingTypeOfApplication.png?alt=media&amp;token=bd36f9a1-e767-4e40-937a-f4fb14f2a97f" alt=""><figcaption><p>Выбор типа приложения в YandexID | OAuth</p></figcaption></figure>

3. Далее заполните необходимую информацию:

* **Название** - произвольное.
* **Иконка сервиса** - произвольное изображение.
* **Почта для связи** - почта на которую будут приходить уведомления об авторизации.

Нажмите "**Продолжить**".

<figure><img src="https://3704471835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPK4TuzRBnP7rt8htho-887967055%2Fuploads%2Fec5eWzMlOdNR8puzUwWS%2FYandexOAuthAppParameters.png?alt=media&amp;token=91c0cb59-38be-4aee-91f3-6c6015347116" alt=""><figcaption><p>Параметры приложения #1</p></figcaption></figure>

4. Далее выберите в качестве платформы "**Веб-сервисы**". В поле "**Redirect URl**" вставьте следующую ссылку:

```
https://192.168.100.60/pbxcore/api/v3/mail-settings/oauth2-callback
```

Замените 192.168.100.60 на ip-адрес Вашей станции.

Нажмите "**Продолжить**".

<figure><img src="https://3704471835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPK4TuzRBnP7rt8htho-887967055%2Fuploads%2FSgMSntdMFi0DHQVpMIVw%2FtypeOfApplication.png?alt=media&amp;token=905a8aa1-17b4-4254-a549-a4a5d2532454" alt=""><figcaption><p>Параметры приложения. Refirect URl</p></figcaption></figure>

5. Далее на странице "**Права доступа к данным пользователей**" в разделе "**Дополнительные**" впишите "**smtp**" и выберите доступ "**Отправка писем через Яндекс.Почту по протоколу SMTP**".

<figure><img src="https://3704471835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPK4TuzRBnP7rt8htho-887967055%2Fuploads%2FyUH5DblyidtJcLVDAzMB%2FyandexOauthPermissions.png?alt=media&amp;token=43014e74-4655-4e70-b9e3-80c27b012960" alt=""><figcaption><p>Выдача необходимого разрешения</p></figcaption></figure>

6. На следующей странице нажмите "**Всё верно, создать приложение**".

<figure><img src="https://3704471835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPK4TuzRBnP7rt8htho-887967055%2Fuploads%2FiZ2ZDbK9vl4TRTmy01Y9%2FYandexConfirmationOfCreation.png?alt=media&amp;token=1857527f-9123-4dc0-99bb-7c10d3d10838" alt=""><figcaption><p>Подтверждение создания приложения</p></figcaption></figure>

После создания приложения будет выведены ClientID и Client Secret. Далее они понадобятся нам для настройки внутри web-интерфейса MikoPBX.

<figure><img src="https://3704471835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPK4TuzRBnP7rt8htho-887967055%2Fuploads%2FbCIg7eLLz0JPEpTamanv%2FYandexOauthCredentials.png?alt=media&amp;token=bcde3210-b132-4449-a41b-018ce4cf0e5b" alt=""><figcaption><p>ClientID и Client Secret</p></figcaption></figure>

### Настройки внутри MikoPBX

1. Перейдите в Web-интерфейс MikoPBX. Далее "**Система**" -> "**Почта и уведомления**" -> "**Настройки SMTP**".

Заполните все необходимые данные:

* **Адрес отправителя, Имя отправителя** - Ваша почта и от какого имени будут отправляться письма.
* **Тип аутентификации** - OAuth2.
* **SMTP логин** - Ваша почта.
* **Провайдер OAuth2** - Yandex Mail.
* **Идентификатор приложения (Client ID), Секретный ключ (Client Secret)** - данные из Yandex (6 пункт из прошлого раздела в этой инструкции).

Все остальные настройки оставьте по умолчанию. Более подробное описание Вы можете найти в главное статье о параметрах почты ([ссылка](https://docs.mikopbx.com/mikopbx/manual/system/mail-settings-1)).

После этого нажмите "**Сохранить**"!

<figure><img src="https://3704471835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPK4TuzRBnP7rt8htho-887967055%2Fuploads%2FVjevzOw7yp4jsZxOQ8YX%2FYandexMikoPBXOauth2.png?alt=media&amp;token=c26358c7-af57-48dd-84d0-d1504590900d" alt=""><figcaption><p>Настройки SMTP в Web-интерфейсе MikoPBX</p></figcaption></figure>

2. Нажмите "**Подключить через OAuth2**". Войдите в Ваш аккаунт Яндекс. После авторизации, нажмите "**Log in as...**".

<figure><img src="https://3704471835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPK4TuzRBnP7rt8htho-887967055%2Fuploads%2FyTZ9b4roSM5NpCpNQNw5%2FYandexOauthServiceLogin.png?alt=media&amp;token=db34021e-87c1-4e68-93e1-1c5e5604fc89" alt="" width="375"><figcaption><p>Раздел "Service login". Авторизация в приложении.</p></figcaption></figure>

3. При успешной авторизации Вы увидите соответствующее окно.

<figure><img src="https://3704471835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPK4TuzRBnP7rt8htho-887967055%2Fuploads%2FnBgoELgytyZDNUIAp4FY%2FYandexOAuthSeccessful.png?alt=media&amp;token=b78b06bc-fc8e-4385-8d2f-1410b80e658e" alt="" width="375"><figcaption><p>Успешная авторизация</p></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.mikopbx.com/mikopbx/manual/system/mail-settings/yandex-oauth2.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
