# Microsoft 365 and Outlook

Forward a Microsoft 365 or Outlook.com mailbox to opendesk and send replies from your address with Microsoft sign-in, Microsoft's SMTP server or a sending service.

A Microsoft 365 or Outlook.com mailbox receives by [forwarding](/guides/mailboxes/forwarding/#microsoft-365-and-outlook): Microsoft passes incoming mail on to a private opendesk address. Replies go out from your address in one of these ways:

- **Microsoft**, when your instance offers it. You approve sending once, and replies go out through Microsoft 365 and land in the mailbox's Sent folder. opendesk gets permission to send mail as you and nothing else: it cannot read, change or delete your mail. See [Send with Microsoft](#send-with-microsoft).
- **Microsoft's SMTP server**, when your admin allows SMTP AUTH. See [Turn on SMTP AUTH](#turn-on-smtp-auth).
- **A sending service** such as Resend or Postmark, over SMTP, once it has verified your domain. See [Send with a sending service](/guides/mailboxes/#send-with-a-sending-service).

On your own instance, a mailbox can also send [through opendesk](/self-hosting/configuration/#sending-through-opendesk).

Microsoft 365 blocks forwarding to outside addresses until an admin allows it, so plan for one admin step. See [Allow forwarding to outside addresses](/guides/mailboxes/forwarding/#allow-forwarding-to-outside-addresses-admin).

## Send with Microsoft

**1. Add the mailbox and pick forwarding**

In **Settings**, open **Mailboxes** and click **Add mailbox**. Type a name and the address. opendesk shows **Microsoft 365** or **Outlook.com**. Keep **Forward mail to opendesk** selected and click **Continue**.

**2. Send replies with Microsoft**

Under **How replies are sent**, keep **Connect Microsoft** selected and click **Continue with Microsoft**. Pick the Microsoft account for the address and accept the permissions. Microsoft sends you back to opendesk with the mailbox connected.

![The connect step for support@contoso.com: How replies are sent, with Connect Microsoft selected and Your SMTP server below it, ringed as 1, and the Continue with Microsoft button ringed as 2](https://heykefu.com/guides/mailboxes/microsoft-forwarding.webp)

Some organizations require an admin to approve new apps. If you see **Need admin approval**, ask a Microsoft 365 admin to grant consent for opendesk.

**3. Forward the mail**

opendesk shows the private address to forward to. An admin allows automatic forwarding to outside addresses in the Microsoft Defender portal, then forwards the mailbox in the Exchange admin center, or you create an Outlook rule. [Forwarding](/guides/mailboxes/forwarding/#microsoft-365-and-outlook) has every step.

**4. Send a test email**

Write to the address from another account. It shows up in **Unassigned** as a new ticket, and your reply goes out through Microsoft 365.

### What opendesk asks for

| Scope | Why |
| --- | --- |
| `openid`, `email` | Identify which Microsoft account was connected. |
| `offline_access` | Keep sending after you close the browser. |
| `https://graph.microsoft.com/Mail.Send` | Send the replies your team writes, from your address. |
| `https://graph.microsoft.com/User.Read` | Read the account's basic profile, such as its address. |

This is send-only access. opendesk cannot read, search, change or delete the mail in your mailbox with it. Tokens are encrypted at rest with AES-GCM.

### Self-hosting

On your own instance, Microsoft sign-in for mailboxes needs your own Microsoft app (`MICROSOFT_CLIENT_ID` and `MICROSOFT_CLIENT_SECRET`), and `MICROSOFT_MAILBOX_OAUTH` turns it on or off for new mailboxes. See [Google and Microsoft OAuth](/self-hosting/oauth-apps/) and [Mailbox sign-in](/self-hosting/configuration/#mailbox-sign-in).

## Send through SMTP

When your instance doesn't offer Microsoft for sending, replies go out through Microsoft's SMTP server, or a [sending service](/guides/mailboxes/#send-with-a-sending-service) that has verified your domain.

![Add a mailbox for support@contoso.com: Microsoft 365 detected from the domain's MX records ringed as 1, the note that Microsoft turned off password sign-in over IMAP ringed as 2, and Forward mail to opendesk, recommended, ringed as 3](https://heykefu.com/guides/mailboxes/microsoft-detect.webp)

1. **Microsoft 365**, found from the domain's MX records. Outlook.com, Hotmail and Live addresses show as **Outlook.com**.
2. **Why forwarding**: Microsoft turned off password sign-in over IMAP, so a password can't read the mailbox.
3. **Forward mail to opendesk**, recommended.

**1. Add the mailbox and pick forwarding**

In **Settings**, open **Mailboxes** and click **Add mailbox**. Type a name and the address, keep **Forward mail to opendesk** selected and click **Continue**.

**2. Choose how replies are sent**

Under **How replies are sent**, **Your SMTP server** is the way listed. Replies come from your address itself, through `smtp.office365.com` on port 587 with STARTTLS. This needs SMTP AUTH turned on for the mailbox (see [Turn on SMTP AUTH](#turn-on-smtp-auth)). The server, port and security are filled in; type the mailbox's password and click **Connect**. opendesk signs in to the SMTP server before it saves anything.

![The connect step for support@contoso.com: Your SMTP server, the only way listed, ringed as 1, the note that Microsoft is phasing out password sign-in for SMTP AUTH ringed as 2, and the outgoing mail settings for smtp.office365.com on port 587 with STARTTLS ringed as 3](https://heykefu.com/guides/mailboxes/microsoft-smtp.webp)

To send through a sending service instead, pick it under **Using a sending service?** and paste its credentials.

**3. Copy the forwarding address**

After you click **Connect**, the last step shows the private address to forward to, with a copy button, and the steps for Microsoft 365. You can find both again on the mailbox's page.

![Add a mailbox, done: the private forwarding address ringed as 1, and the four Microsoft 365 forwarding steps ringed as 2](https://heykefu.com/guides/mailboxes/microsoft-forward-to.webp)

**4. Allow forwarding to outside addresses**

Microsoft 365 blocks automatic forwarding to outside addresses by default. An admin allows it in the [Microsoft Defender portal](https://security.microsoft.com): **Email & collaboration**, **Policies & rules**, **Threat policies**, **Anti-spam**. Create an outbound policy for the support mailbox only (the tidier choice), or open **Anti-spam outbound policy (Default)**, and set **Automatic forwarding rules** to **On - Forwarding is enabled**.

**5. Forward the mail in Microsoft**

As an admin, in the [Exchange admin center](https://admin.exchange.microsoft.com), open **Recipients**, **Mailboxes** and select the mailbox. Under **Mail flow settings**, choose **Manage email forwarding**, turn on forwarding, paste the address and keep **Deliver to both** on if the mailbox should keep a copy. Without admin rights, use an Outlook rule instead. [Forwarding](/guides/mailboxes/forwarding/#microsoft-365-and-outlook) has both, step by step.

Then write to the address from another account. The email shows up in **Unassigned** as a new ticket.

## Turn on SMTP AUTH

Sending replies through Microsoft's SMTP server needs **SMTP AUTH** (authenticated SMTP) for the mailbox. Many organizations keep it off. An admin turns it on for one mailbox:

**1. Open the user in the Microsoft 365 admin center**

In the [Microsoft 365 admin center](https://admin.microsoft.com), open **Users**, **Active users**, and select the user for the support address.

**2. Allow Authenticated SMTP**

On the **Mail** tab, choose **Manage email apps**, tick **Authenticated SMTP** and click **Save changes**. It can take up to an hour to apply.

The same in Exchange Online PowerShell:

```powershell
Set-CASMailbox -Identity support@contoso.com -SmtpClientAuthenticationDisabled $false
```

> **Note**
>
> - The per-mailbox setting wins over the organization's default, under **Settings**, **Mail flow** in the Exchange admin center.
> - **Security defaults** in Microsoft Entra, and Conditional Access policies that block legacy sign-in, refuse a password over SMTP for the whole organization. Turning SMTP AUTH on for the mailbox doesn't change that.
> - The account signs in with its password alone: an account that asks for multi-factor sign-in can't send this way.
> - Microsoft is phasing out password sign-in for SMTP AUTH in Exchange Online. When your organization no longer accepts it, send with Microsoft, or through a sending service.

If your admin keeps SMTP AUTH off, send with Microsoft, or through a [sending service](/guides/mailboxes/#send-with-a-sending-service).

## If Microsoft refuses the sign-in

Nothing is saved when Microsoft refuses. The wizard shows the cause and the fix, with Microsoft's own reply underneath.

| What you see | What to do |
| --- | --- |
| **SMTP sign-in is turned off in Microsoft 365** | Turn on SMTP AUTH for the mailbox, as above, or send with Microsoft. |
| **Microsoft security defaults block passwords** | Security defaults refuse passwords over SMTP and IMAP. Send with Microsoft, or through a sending service. |
| **A Microsoft sign-in policy blocked this** | A Conditional Access policy refused the password. Send with Microsoft or through a sending service, or ask your admin to allow SMTP AUTH for this mailbox. |
| **Microsoft needs Microsoft sign-in** | Exchange Online doesn't accept a password over IMAP. Forward the mail, and send with Microsoft. |
| **Microsoft did not accept the password** | Check the address and password, including the sign-in address if it differs from the mailbox address. An account with multi-factor sign-in can't use a password here. |

## On your own instance: receive over IMAP

On a self-hosted instance with IMAP receiving on (`MAILBOX_IMAP`, the default), **Choose another way** also lists **Sign in with Microsoft**, which syncs the mailbox over IMAP instead of using forwarding. opendesk then reads new mail over IMAP (`outlook.office365.com`) and sends replies through Microsoft, with no forwarding to set up. opendesk Cloud receives by forwarding.

Syncing asks for one more permission, `https://outlook.office.com/IMAP.AccessAsUser.All`, which lets opendesk read the mailbox. Your Microsoft app needs it, as described in [Google and Microsoft OAuth](/self-hosting/oauth-apps/#microsoft). Choose forwarding to keep the connection send-only.

### IMAP must be enabled

In Microsoft 365, IMAP can be turned off per mailbox. For a synced mailbox, an admin turns it on in the [Microsoft 365 admin center](https://admin.microsoft.com) under **Users**, **Active users**: select the user, then **Mail**, **Manage email apps**, and tick **IMAP**.

## Disconnect

Remove the mailbox in opendesk, under **Mailboxes**. Then, at Microsoft:

- **Forwarding**: turn off the forwarding or the Outlook rule, so mail stops going to the old address.
- **Microsoft**: remove opendesk from [My apps](https://myapps.microsoft.com), or as an admin from **Enterprise applications** in Microsoft Entra.
- **SMTP**: change the mailbox's password, or turn SMTP AUTH off again.

## Related

- [Connect a mailbox](/guides/mailboxes/)
- [Forwarding](/guides/mailboxes/forwarding/)
- [Other providers](/guides/mailboxes/imap-smtp/)
