> For the complete documentation index, see [llms.txt](https://docs.3dolphins.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.3dolphins.ai/5.3.0-id/integration/chanel-connector/email-inbox/how-to-setup-email-outlook.md).

# How to Setup Email Outlook

Saat ini kami menyediakan integrasi antara 3Dolphins dengan outlook email. Untuk dapat melakukan integrasi tersebut, sebelumnya Anda harus memenuhi persyaratan minimum berikut ini:

* Anda harus sudah memiliki email bisnis.
* Email tersebut harus sudah berlangganan Office 365.

### Create App Registration on Microsoft Azure

Setelah memastikan bahwa Anda telah memenuhi persyaratan minimum diatas, silahkan buat app registration pada microsoft azure. Pertama, masuk ke halaman <https://portal.azure.com/#home> menggunakan akun email bisnis Anda.&#x20;

<figure><img src="/files/oSaf7S8PYN0oqZSRHTVR" alt=""><figcaption><p>Dashboard Portal Azure</p></figcaption></figure>

Kemudian, buka menu **App Registrations**. Pada halaman app registrations, klik tombol **'+ New Registration'.**

<figure><img src="/files/oXOMgAqkbmCEeo1jg39h" alt=""><figcaption><p>New Registration</p></figcaption></figure>

Masukkan informasi pendaftaran aplikasi Anda:

1. **Name**: Masukkan nama aplikasi yang akan ditampilkan kepada user.
2. Pilih opsi **Accounts in any organizational directory and personal Microsoft accounts**dari bagian **Supported account types**.
3. Pilih platform **'Web'** dan isi URL dengan https\://\[url]/dolphin/channel/authorization/channel-email-outlook.xhtml

Kemudian, klik tombol **'Register**' untuk membuat aplikasi.

<figure><img src="/files/NUnVGjTm1YJzipGFyAsj" alt=""><figcaption><p>Register Application</p></figcaption></figure>

Setelah beberapa saat, pendaftaran aplikasi yang baru berhasil dibuat akan terbuka.

<figure><img src="/files/cyVUbHv5HdoKLfXznbhK" alt=""><figcaption><p>Created App Registration</p></figcaption></figure>

{% hint style="info" %}
Simpan informasi app Anda berupa Client ID dan juga Tenant ID.&#x20;
{% endhint %}

Setelah itu, buat client crediantials Anda dengan mengklik tombol **'Add a certificate or secret'**. Kemudian, klik tombol **'New client secret'**.

<figure><img src="/files/r2KZ9GCtl9XrkS8F4LrH" alt=""><figcaption><p>Add Client Secret </p></figcaption></figure>

Pada dialog yang muncul, masukkan deskripsi opsional untuk client secret Anda dan pilih periode expired dari tombol drop-down list Expires, lalu klik tombol **'Add'**.

<figure><img src="/files/nmYjiAHJH4PjoAAYOsAB" alt=""><figcaption><p>Add Client Secret</p></figcaption></figure>

Client secret Anda sudah berhasil terbuat. Perlu diingat, untuk menyimpan value dan tanggal expired dari client secret tersebut.&#x20;

<figure><img src="/files/NHHGwBIHaa09ydIJiG0L" alt=""><figcaption><p>Client Secret Added</p></figcaption></figure>

{% hint style="warning" %}
Simpan **"value"** dikarenakan hanya muncul satu kali. Jika Anda lupa menyalinnya, Anda harus membuat ulang client secret kembali.
{% endhint %}

### Modify IMAP & SMTP Via Windows Powershell

Setelah berhasil membuat aplikasi azure, Anda harus memodifikasi IMAP & SMTP email tersebut via windows powershell, sehingga email tersebut memilki akses lengkap. Berikut merupakan command untuk memodifikasi di masing-masing sistem operasi.&#x20;

#### Windows OS&#x20;

Pertama, buka windows powershell sebagai Administrator. Kemudian, masukkan command berikut.

<pre class="language-powershell"><code class="lang-powershell">Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
<strong>Install-Module -Name ExchangeOnlineManagement
</strong>Install-Module Microsoft.Graph 
Import-module ExchangeOnlineManagement
Install-Module -Name AzureADPreview
</code></pre>

Kemudian, klik Enter dan masukkan Y. Tunggu sampai installing package selesai lalu masukkan command berikutnya.&#x20;

```powershell
Connect-AzureAD -TenantId <your tenant id>
```

Login menggunakan alamat email bisnis Anda dan masukkan password. Tunggu sampai proses selesai. Kemudia, masukkan command berikut.&#x20;

{% code overflow="wrap" %}

```powershell
Connect-ExchangeOnline -Organization <your tenant id> 
```

{% endcode %}

Lalu, login kembali menggunakan email bisnis Anda. Setelah berhasil connect masukkan data aplikasi ke variabel dengan cara:

```powershell
$MyApp = Get-AzureADServicePrincipal -SearchString "your app name"
```

{% code overflow="wrap" %}

```powershell
New-ServicePrincipal -AppId $MyApp.AppId -ServiceId $MyApp.ObjectId -DisplayName "Service Principal for IMAP"
```

{% endcode %}

{% code overflow="wrap" %}

```powershell
Add-MailboxPermission -Identity yourbusinessemail@microsoft.com -User $MyApp.ObjectId -AccessRights FullAccess
```

{% endcode %}

Jika Anda sudah sampai langkah ini maka, channel email Anda sudah dapat menerima inbound email. Berikut merupakan command untuk mendapatkan akses penuh untuk outbound email.

{% code overflow="wrap" %}

```powershell
Set-CASMailbox -Identity yourbusinessemail@mailmicrosoft.com -SmtpClientAuthenticationDisabled $false
Set-CASMailbox -Identity yourbusinessemail@mailmicrosoft.com -IMAPEnabled $true
```

{% endcode %}

#### Mac OS

Bila sistem operasi Anda menggunakan Mac, Anda harus menginstall powershell terlebih dahulu dengan menggunakan command berikut pada terminal.&#x20;

```shell
brew install --cask powershell
```

Lalu, buka windows powershell dan masukkan command berikut.

```powershell
Register-PSRepository -Default
Install-Module -Name ExchangeOnlineManagement -allowprerelease
Install-Module Microsoft.Graph -allowprerelease
Install-Module -Name Az
Import-module ExchangeOnlineManagement
```

Kemudian, klik Enter dan masukkan Y. Tunggu sampai installing package selesai lalu masukkan command berikutnya.

```powershell
Connect-AzAccount -Tenant <your tenant id>  
```

Lalu, login kembali menggunakan email bisnis Anda. Setelah berhasil connect masukkan data aplikasi ke variabel dengan cara:

```powershell
Connect-ExchangeOnline -Organization <your tenant id> 
```

Lalu, login kembali menggunakan email bisnis Anda. Setelah berhasil connect masukkan data aplikasi ke variabel dengan cara:

```powershell
$MyApp = Get-AzADServicePrincipal -SearchString "your app name"
```

{% code overflow="wrap" %}

```powershell
New-ServicePrincipal -AppId $MyApp.AppId -ServiceId $MyApp.Id -DisplayName "Service Principal for IMAP"
```

{% endcode %}

{% code overflow="wrap" %}

```powershell
Add-MailboxPermission -Identity yourbusinessemail@microsoft.com -User $MyApp.Id -AccessRights FullAccess
```

{% endcode %}

Jika Anda sudah sampai langkah ini maka, channel email Anda sudah dapat menerima inbound email. Berikut merupakan command untuk mendapatkan akses penuh untuk outbound email.

{% code overflow="wrap" %}

```powershell
Set-CASMailbox -Identity yourbusinessemail@mailmicrosoft.com -SmtpClientAuthenticationDisabled $false
Set-CASMailbox -Identity yourbusinessemail@mailmicrosoft.com -IMAPEnabled $true
```

{% endcode %}
