Files
13303b247e v0.3.9 milestone (#283)
* Run the end-to-end suite on pull requests into milestone and wip branches

A release's work is now collected on a milestone branch (milestone/v0.4.0)
before it reaches main, and the suite only ran on pull requests into main,
so nothing proposed for the milestone was tested. `milestone/**` joins
`main`, and `wip/**` comes along from wip/28, where it already runs the
suite on the phases of #28 — the same block on both, so they merge
without a conflict.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit d009ff72ad)

* linked-issue: read the description of a pull request into a milestone branch (#254)

GitHub links an issue from "Closes #N" only in a pull request into the
default branch. Into milestone/v0.3.8 or a wip/ branch the closing
references stay empty, so the check failed on every such pull request
however its description named the issue (#252 was the first). For a pull
request into another branch, the description is now read for the same
keywords GitHub accepts.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* The release pull request is the suite run behind a tag (#252)

Releasing asked for the E2E workflow to be started by hand on main before
a tag. Since main became protected, the Release vX.Y.Z pull request cannot
merge until that workflow is green on it, and its commit is what is tagged,
so a manual run only ran the same jobs twice. Releasing now says so, and to
update the branch if main moved after its checks ran, since the protection
does not ask for up-to-date branches.

The paragraph in CONTRIBUTING and the header of e2e.yml that said main is
not verified commit by commit describe main before it was protected; both
now describe it as it is.

Closes #251

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Calendar on a phone: a readable month, a toolbar and top bar that fit, a live now line (#256)

The month chip is its title first, on up to two lines, then its time range
and place; a narrower day drops the end and the place for a third line of
title, long words are hyphenated, and an unanswered invitation has a
dashed bar. Below 39rem, where a day is bars, the grid shrinks and the
chosen day is listed in full under it: today at first, any tapped day
after, with a + for that day that the toolbar's + follows too. On a wider
touch screen the first tap opens a day's card and the second its entry
(calendar--month-tap, and a day-open: variant that the hover and the tap
share).

The calendar toolbar fits below 37rem with icons, a short date label and
smaller buttons, and under 22rem today's date in a box for Today. English
writes a same-month week as "Oct 20-26" (range_short_month). The top bar
tightens below 640px and moves Sync now, What's new and Send feedback into
the user menu. Dialogs are the whole screen below 768px, as compose is.

calendar--now moves the now line every minute on the view's clock and
redraws a view that shows the old day or the new one when the date
changes, which also moves the month's circle on today.

And a + on a day that has gone opened the editor on today:
DefaultEventStart::onDay pulled any past day to the next hour. A past day
now keeps its date.

Closes #253

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Close an issue when its pull request is merged into a milestone branch (#260)

GitHub acts on "Closes #N" only for merges into the default branch, so
issues fixed on a milestone branch stayed open until the release reached
main. A workflow on merged pull requests into milestone/** now closes the
issues the description names, with a comment linking the pull request.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Preview the reply, not the quote, and send replies with their quote visible (#258)

The list preview flattened the whole body and skipped short blocks to find
the first long one, so a one-line reply previewed as its attribution line or
the quoted mail. The quoted history (same seam as the reading view's "···")
and a "-- " signature are cut off first now, in HTML and plain text, and the
chrome skip only applies to bulk mail. The JMAP preview uses the same code.

The composer folded the quote with an inline display: none and its clean-up
removed only the toggle, so replies went out with an invisible quote. The
fold is removed in the editor and again on the server, and the reading view
reveals a folded quote in mail already received.

Closes #257

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Move a thread's unread count when JMAP marks a message read or unread (#267)

EmailPatchApplier wrote seenAt for $seen and left MessageThread::$unreadCount alone, so the web list (which draws bold from that counter) disagreed with the phone app. $seen now goes through ThreadStatusUpdater::markRead(), the web UI's own path, and markRead() counts the whole thread rather than the messages passed in.

Closes #266

Co-authored-by: Philippe Delodder <7259755+phdelodder@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Leave a message that is already in the destination folder where it is (#270)

Trashing a conversation with a message already in the bin queued that message as a move from Trash into Trash. webklex's move() then left the connection in EXAMINE and the server refused it ("NO Not permitted in EXAMINE state"), and the row had already lost its UID. ApplyImapFlagsHandler no longer sends a move into the folder a message is in (and gives the row its UID back), and ThreadStatusUpdater's trash(), archive() and restore() leave such messages out of the move.

Closes #269

Co-authored-by: Philippe Delodder <7259755+phdelodder@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Hide a conversation from the lists only when all of it is in the bin (#272)

A thread's labels are the union of its messages', so one deleted message put Trash on the thread and took the whole conversation out of the Inbox, its tab, label lists, All Mail, Unread, the badges and search, along with any reply threaded into it afterwards. The bin rule is now "carries Trash and has no message outside it", written once (binnedThreads()) for every list and badge and spelled out the same way in the search SQL. Option (b) of the issue.

Closes #268

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Let a long message scroll in the expanded compose window (#273)

expandedValueChanged() used closest('div') to reach the editor's wrapper, but closest() starts at the element itself and the editor is a div, so the wrapper never became a flex container and the editor stayed 170px tall, clipped by [contain:paint]. The wrapper is now the flex column and the editor grows (1 0 auto) to fill the window or its content; the plain-text field fills the expanded window too.

Closes #262

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Write each changelog entry as a file of its own, collected at release (#275)

Every pull request added its paragraph under ## Unreleased in CHANGELOG.md at the same place, so the second of any two conflicted with the first once it merged, and each conflict fix re-ran the whole E2E suite. A pull request now adds changelog.d/<issue>-<words>.md; bin/changelog-release.sh, run in the Release vX.Y.Z pull request, collects the fragments (highlights first) and anything still under ## Unreleased into the release's section and deletes them. CHANGELOG.md stays the one file What's new, bin/release-notes.sh and GitHub read.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Say which step failed when notifications can't be turned on (#278)

Every failure in the enable path (registering the service worker, the
browser's push subscription, the server's answer) ended in the same
"Something went wrong" and the exception was dropped, so a report from a
Pixel 8 could not say which. The pane now names the step and the
DOMException name or HTTP status, and logs the exception to the console.

Closes #277

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Contacts: one address book, with Google, Outlook, Nextcloud and CardDAV contacts in it (#282)

A contacts page and pane for plMail's own contacts and the ones on a server:
Google and Outlook on the mail account's own sign-in, Nextcloud through the
Nextcloud connection, any CardDAV server through Settings -> Contacts. Every
field a phone keeps, the photo included, syncs both ways. Duplicates merge
with 90 days to undo; vCard and CSV import and export; contacts suggested
while composing; JMAP Contact/get, /query and /set. Nextcloud calendars come
with the Nextcloud connection too.

Replaces #237 and #109 by @jo2904 and #244 by @DanversKara.

Closes #157
Closes #236

Co-authored-by: jo2904 <jo2904@users.noreply.github.com>
Co-authored-by: DanversKara <DanversKara@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Install APCu and Xdebug with PIE instead of from PECL (#286)

PECL is deprecated in favour of PIE and was down for most of an evening on 2026-10-21, failing every image build. PIE 1.5.2 now installs APCu (and Xdebug in the dev image) from the extensions' own releases; it is mounted for that one step and not left in the image. Nothing changes at runtime.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Keep contact photos where the web container can serve them (#287)

Contact photos were stored in var/contacts, outside the volumes the web and worker containers share, so synced photos answered 404. They now live under APP_STORAGE_DIR/uploads/contacts; a migration clears the lost paths and has synced books read again so the photos come back.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Match a contact's email addresses in any case (#288)

Addresses are stored lower-cased but were matched as the provider spelled them, so a pull removed and re-inserted the same address and broke the unique key (prod sync failure). They are now matched in their stored form.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Open a contact's reference email in the mail pane (#294)

A click on one of a contact's reference emails in the docked contacts
pane was a Turbo visit inside the contacts frame, which blanked the mail
pane. The click is now offered to the mail pane as a mail-pane:open
event; the pane opens the message beside the contact. Without a mail
pane (the full contacts page) it stays an ordinary visit.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Open mail beside the full Contacts page without a reload (#297)

The full Contacts page was a page of its own, so a reference email
clicked there was a visit: the contact was gone, and on a notebook the
mailbox came back on the calendar it remembered.

The full page is now the mailbox with data-contacts-full on the shell:
the mail column put away and the contacts dock given the row, with the
page's own content in the dock's frame. Opening a message from it loads
the message into the existing mail pane, then contacts--pane#reveal
drops the state in a view transition: the mail slides in from the left
and the dock narrows to its width, the same DOM throughout. On a
notebook the calendar gives way; on a wide screen it stays.

The reference links lose data-turbo-frame="_top", which made ui--split
stash a calendar position for a visit that never came.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Preview image and video attachments on click, like PDFs (#295) (#298)

Clicking an image or video attachment chip opens a viewer in the modal
instead of downloading. Previewable chips (PDF included) get a download
half on the right. Images load from the existing attachment route; videos
from a new /mail/attachment/{id}/video route that serves a fixed video
type inline under the sandbox CSP and answers Range requests.

Closes #295

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Erase a message's parts with it, and delete mail one way (#300)

MessageEraser loaded a message's parts to delete their files, then removed
only the message. After the delete Doctrine forgot the message but kept the
parts managed, so the next flush in the same unit of work failed with "a new
entity was found through the relationship MessagePart#message". Every sync
that removed server-deleted mail with an attachment failed that way.

The eraser now removes the parts, removes a thread it empties (announced to
JMAP as destroyed), and logs file-delete failures instead of keeping the row.
MessagePurger hands its local delete to the eraser, so "delete forever" gains
the thread-label re-sync it lacked. ImapAccountSyncer clears an entity manager
a failed folder left open, so one folder's refused flush no longer fails the
rest.

Closes #299

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Rework the contact editor: quick add, paste details and Improve with AI (#305) (#306)

New contacts start in quick add: paste a name, signature, address line or
vCard and the details it finds are listed, each with a one-click type. The
editor shows the name as one field whose parts fill themselves (titles and
degrees included), rows that appear as you type, Paste details for existing
contacts and a Save to picker. Contact help is a new AI feature, off by
default, that rereads pasted text and suggests updates from the signature
of a contact's newest mail. Phones are read with libphonenumber.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Keep spam off the radar and out of search; add a Not spam button (#308)

Cards read out of mail in Spam are left off the Happening Soon panel and
the mailbox strip (read-time filter, so moving the mail out brings them
back), and a spam conversation no longer shows its cards above the
message. The bin keeps its cards. Search and the type-ahead leave Spam
out unless asked with in:spam, as they already did for the bin. A spam
conversation's toolbar gets a Not spam button that moves it to the inbox.

Closes #304

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Add to contacts asks new or existing; contacts button gets the calendar's three positions (#312)

Closes #309
Closes #311

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Show the pictures a review request hid, dropped or never asked for (#274)

* Show the pictures a review request hid, dropped or never asked for

A BAUHAUS review request, sent through Bazaarvoice, showed neither its
logo nor its product photos, with images allowed. The image proxy was
fine; three steps around it were not.

- The logo is linked as http://. The sanitizer keeps http sources and
  leaves them to render time, the fetcher only connects over TLS, and
  nothing in between upgraded the URL, so every http image became the
  placeholder. RemoteContentBlocker now signs the https:// form. The
  fetcher's own rules also say in the log which one refused a target;
  until now that refusal was the one silent path.
- The first product card sits inside a <form>, and dropElement('form')
  took the photo, the name and the star links with it. The form is
  unwrapped now; textarea and select still go with their content.
- Each card is class="d" style="display:none", switched on with
  .d {display:block !important}. CssToInlineStyles keeps an inline
  property whatever the rule says, so the card stayed hidden next to its
  Outlook twin. Html5CssInliner now lets a stylesheet !important beat a
  plain inline style, and matches selectors against forms as the divs
  the reader will see, so `form .a` rules take the sender's fallback
  for clients without forms.

  app:backfill safe-html-hidden-cards

re-sanitizes stored mail with a form or a stylesheet !important. One
task for both, because neither fix brings the card back alone.

Closes #271

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Mark the German mail page as translated from the current English one

Both pages gained the same two paragraphs in the previous commit, but
the translated-from hash still named the English page before them, so
DocumentationCoverageTest reported the translation as stale.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Credit the image proxy entry and keep it as a changelog fragment

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Paul Lützner <karatektus@gmail.com>

* Swipe a mail row, choose what each swipe does, and long-press for its actions on a phone (#314)

On a phone, below md and by touch only: a row swipes right for read/unread and left for archive, each direction set under Settings → Mail → Swipe actions (read/unread, archive, star, nothing; never trash), and holding a row opens an action sheet with every action its strip offers. Mouse, trackpad and wider windows are unchanged.

Takes over #117, #118 and #119, whose fork was archived. Also gives the Contacts settings' two cards their gap.

Co-authored-by: Flouss <15911342+Flouss@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Admin → Integrations lists the calendar services, so a pinned CalDAV address can be changed later (#279)

CalDAV and Calendar feed get their own group below the file services, with the shared provider row and Configure form; Nextcloud stays with the file services. Calendar services are offered to everyone, so their rows say so and the form has no switch. The server address accepts only http or https, up to 512 characters.

Once people have connected, the CalDAV form says how many connections a changed or cleared pin reaches. A calendar feed offers its address only while one is stored, so it can be cleared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Offer an address book another connection already mirrors locked, not as new (#319)

Two connections to the same server, a Nextcloud one and a CardDAV one made by hand, reach the same address book under the same remote id. Settings → Contacts now offers such a book locked, saying which connection has it, and refuses a posted tick, as it does for calendars. Otherwise every contact in it showed twice.

Closes #317

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Gmailify: the IMAP folder places a sibling's mail, Gmail deletions detach, and a switch to turn it off (#204)

Closes #203
Closes #205

- A sibling's IMAP copy keeps the placement its folder gives it; Gmail's INBOX/SENT/DRAFT/TRASH/SPAM no longer move it (by @phdelodder).
- Gmail deleting its copy detaches the sibling's IMAP copy instead of erasing it.
- app:backfill gmailify-placement repairs copies the old merge had moved.
- Settings → Aliases: a Gmailify switch per Gmail account. Off detaches carried copies in a background job and declines mail Gmail still collects for another account (Bcc'd mail excepted, as documented).

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Gmail sync: look up only the listed ids, not every stored one (#321)

Part of #223: newGmailIds() asks only about the ids Gmail just listed, and nothing when none were.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Store whether a conversation is in the bin, kept by triggers (#322)

Part of #223: message_thread.binned holds #268's rule, kept by triggers on message_label, thread_label and message; lists, badges and search read the column. Identical results on 41 compared queries, most 5-100x faster on a 67k-thread mailbox.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Account sync: wait out a provider that can't be reached, quietly (#333)

When the worker couldn't connect to the Gmail or Graph API at all, the
account sync went up Messenger's retry ladder: a WARNING with three nested
stack traces per attempt, then CRITICAL and a parked job if the outage
lasted. That job resumes from a cursor and is asked for again every
quarter hour, so nothing was ever lost.

WaitOutConnectionFailures now puts a SyncAccountMessage that failed only
with an HttpClient TransportException back on its own queue, on the
ingest ladder's delays, with one info line per attempt. After five waits
it is dropped with a single warning. Message batches and every other
failure keep the normal path.

Closes #332

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Sven Joder <sj@pmdevelopment.de>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Philippe Delodder <7259755+phdelodder@users.noreply.github.com>
Co-authored-by: jo2904 <jo2904@users.noreply.github.com>
Co-authored-by: DanversKara <DanversKara@users.noreply.github.com>
Co-authored-by: Flouss <15911342+Flouss@users.noreply.github.com>
2026-10-23 11:18:21 +02:00

237 lines
15 KiB
Markdown

# Microsoft
Outlook.com, Hotmail and Microsoft 365 mailboxes reach plMail through **Microsoft Graph** and an
application you register in the Azure portal. There is no IMAP path for them, and that is
deliberate: Exchange Online classifies IMAP, POP and SMTP as legacy authentication in Conditional
Access, so IMAP with OAuth is blocked outright in any tenant running Security Defaults — which is
the default for new tenants. Graph is the only path that works everywhere, and the only one
Microsoft is still investing in.
The registration is one-time, for the whole installation, and it covers mail *and* calendars. Once
it exists, users add accounts under **Settings → Mail accounts** with no further administration —
see [Accounts and aliases](../features/accounts.md) and
[Connected calendars](../features/calendar-sync.md).
## Registering the application
1. Open [portal.azure.com](https://portal.azure.com) and go to **Microsoft Entra ID → App
registrations → New registration**. Give it a name; that name is what users see on the consent
screen and in their Microsoft account's list of connected applications.
2. **Choose who can sign in.** This is the decision that has to agree with plMail's tenant setting,
and the section below spells out which value pairs with which. *"Accounts in any organizational
directory and personal Microsoft accounts"* matches the default of `common`.
3. Set the redirect URI platform to **Web** and paste in the address plMail shows you:
```
https://your-domain/oauth/microsoft/callback
```
That is the `/oauth/{provider}/callback` route with `microsoft` as the provider.
**Admin → Integrations → Mail sign-in → Microsoft mail sign-in** renders the exact URI for your
installation with a copy button, and the setup wizard shows the same one. Paste it rather than
typing it: Microsoft matches it exactly, and it cannot be changed later without breaking every
connection already authorised against it.
4. After registering, copy the **Application (client) ID** from the overview page.
5. Under **Certificates & secrets**, create a client secret and copy its **Value** — not its ID —
immediately. Azure shows the value once and never again.
6. Under **API permissions**, add the delegated Microsoft Graph permissions listed below.
The client ID and secret go either in **Admin → Integrations → Mail sign-in → Microsoft mail
sign-in**, which stores them in the database, or in `MICROSOFT_OAUTH_CLIENT_ID` and
`MICROSOFT_OAUTH_CLIENT_SECRET` in the environment. A stored value wins over the environment, and
only when it is actually set, so an installation already configured through the environment keeps
working untouched. See the [configuration reference](../install/configuration.md).
## The delegated permissions, and what each one is for
All of these are **delegated** Microsoft Graph permissions — plMail acts as the signed-in user and
never as the application. plMail requests them as a set at consent time, and Microsoft consents to
the set as a whole; unlike Google there is no partial grant to handle.
| Permission | What it is for |
|---|---|
| `offline_access` | Returns a refresh token. Without it the connection works until the first access token expires and then stops. |
| `openid`, `email`, `profile` | Identify the signed-in account, which is what plMail names the account after. |
| `User.Read` | Reads `/me`. It is the first thing `app:graph:diagnose` probes, because identity working while everything else fails localises the problem to the mailbox rather than the credentials. |
| `Mail.ReadWrite` | Folders, messages, attachments, flags, moves and deletes — the mail sync itself. |
| `Mail.Send` | Sending. Separate from the above in Graph's model, so it has to be added separately. |
| `MailboxSettings.ReadWrite` | Master categories, at `/me/outlook/masterCategories`. These are **not** covered by `Mail.ReadWrite`: they live under the Outlook user-settings resource and return `ErrorAccessDenied` without this. ReadWrite rather than Read because plMail creates category definitions when a label is mirrored. |
| `Calendars.ReadWrite` | Calendars on the same account, read and write. |
| `Contacts.ReadWrite` | Outlook contacts on the same account, read and write: each contact folder is an address book. |
Two of them are worth understanding before you decide to skip one.
**Without `MailboxSettings.ReadWrite`, mail is entirely healthy and categories are not.** Folders,
messages, attachments and send all work; categories stop syncing in both directions, so labels that
are not folder-backed never appear in Outlook and Outlook's categories never appear in plMail.
`app:graph:diagnose` reports exactly this as a warning rather than a failure, because it is a real
and survivable state.
**Without `Calendars.ReadWrite`, mail keeps working and calendars simply do not appear.** That is
the whole cost, and it is what the admin screen says: *"Nothing to set up here. Add the
Calendars.ReadWrite delegated permission to this app registration — users then get their calendars
with the same sign-in they already use for mail."*
### Calendar is on the same sign-in as mail
There is no separate calendar connection to enable, no second application and no second consent
screen. `Calendars.ReadWrite` is requested on the same grant as the mail permissions, so as an
administrator you tick one more box in this app registration and there is nothing else to
configure anywhere. Read-write rather than read-only because an event edited in plMail is written
back to Outlook, which means creating, updating and deleting on Microsoft's side.
If calendars do not appear for a user, plMail says which of the possible causes it is in
**Settings → Calendars**: the permission may not be on the app registration, or the account may
genuinely have no calendars.
### Contacts are on the same sign-in too
`Contacts.ReadWrite` rides the same grant. A Microsoft account connected to plMail brings its
Outlook contacts with it: each contact folder appears as an address book under **Contacts**, with
Outlook's categories as tags, and an edit made in plMail is written back. See
[Contacts](../features/contacts.md).
Outlook's contact has fixed places where plMail has lists: three email addresses, two business and
two home numbers and one mobile, one home, one business and one other address, one spouse (or
partner), one manager, one assistant and the children's names, one website (the work one if there
is one), three chat addresses and a birthday. plMail fills those places, primary first. An entry
beyond them — a fourth email address, a second partner — is not sent, and stays only in plMail until
the contact next changes in Outlook, when Outlook's version comes back. Outlook has no place at all
for other dates (an anniversary), a phonetic middle name or custom fields; those stay in plMail. Its
chat addresses carry no service: a SIP address comes back as SIP, any other as "other".
Photos go both ways, with one exception: Microsoft Graph can replace an Outlook contact's photo but
not remove it, so a photo removed in plMail stays in Outlook.
An account connected before plMail asked for contacts holds a token without the permission. Mail
and calendars carry on, and **Settings → Account health** shows a notice whose button signs in once more
and adds it.
## The tenant value
`MICROSOFT_OAUTH_TENANT` — or the **Tenant** field in **Admin → Integrations → Mail sign-in** —
decides which accounts may sign in. It has to agree with the supported account types you chose when
registering the application.
| Value | Who may sign in | Pairs with |
|---|---|---|
| `common` | Work or school accounts **and** personal Microsoft accounts | *Accounts in any organizational directory and personal Microsoft accounts* |
| `organizations` | Work or school accounts only | *Accounts in any organizational directory* |
| `consumers` | Personal Microsoft accounts only | *Personal Microsoft accounts only* |
| a tenant GUID | One organisation | *Accounts in this organizational directory only* |
The default is `common`. `organizations` is worth choosing if you do not need outlook.com addresses,
because it avoids the consumer-account edge cases entirely — personal accounts have no immutable
ids and reduced `$filter` support, and both surface as odd behaviour rather than as errors.
**A mismatch fails at consent time, not at setup.** Using `common` against an app registration
restricted to a single tenant produces `AADSTS50194`, which arrives as a failed sign-in for the user
long after the administrator has finished and moved on. plMail translates the common Microsoft
error codes into sentences rather than showing the raw code — the one for this case says the account
type cannot sign in with the current configuration and names the setting to check.
## Push, and what it needs
Instant delivery works out of the box here, with no extra cloud resources — the only requirement is
that your public address is HTTPS and actually reachable from the internet, so Microsoft can call
back. See [Behind a reverse proxy](../install/reverse-proxy.md).
Graph proves a subscription is real by **POSTing a `validationToken` to your notification URL and
expecting the raw token echoed back as `text/plain` within ten seconds**, synchronously, inside the
create call. That has a pleasant consequence: a deployment that is not actually reachable fails at
registration, loudly and harmlessly, rather than registering a subscription that then silently never
delivers. The account or calendar stays on polling.
Notification URLs are built from your configured public address, never from the incoming request.
Reverse proxies are the normal deployment, and a URL derived from a request carries an internal
hostname or `http://` after TLS termination — which Graph rejects with a validation error that is
genuinely unpleasant to diagnose.
| | Mail | Calendar |
|---|---|---|
| Resource | `/me/messages` | `me/calendars/{id}/events` |
| Change types | `created,updated,deleted` | `created,updated,deleted` |
| Endpoint | `POST /webhook/graph/notify` | `POST /webhook/graph/calendar` |
| Lifecycle endpoint | `POST /webhook/graph/lifecycle` | — |
| Proof it is genuine | `clientState` in the body | `clientState` in the body |
| Lifetime | just under three days | just under three days |
| Renewal | `PATCH` the expiry | `PATCH` the expiry |
| Registered by | per account, when instant delivery is switched on | per calendar, hourly sweep |
Mail push is opt-in per account: **Settings → Mail accounts → Instant delivery**. If registration
fails the flag is rolled back, so the interface never claims push is on while nothing is being
delivered. Renewal runs nightly with a twelve-hour threshold against a three-day lifetime.
Calendar push is per calendar, because Graph subscribes to a resource and six mirrored calendars are
six resources with six secrets and six expiries. Nothing registers a calendar channel at the moment
you tick a calendar to mirror — a registration is attempted off the request and then, if it did not
take, retried by the hourly `app:calendar:push` sweep. That is deliberate: registration fails for
deployment reasons that have nothing to do with the click, and tied to the subscribe flow alone
those calendars would never get push until somebody unsubscribed and re-subscribed them.
Both notifications are content-free — they say "something changed here" and nothing about what — so
the webhook does one thing, queue a sync for the resource it names, and every decision stays in the
sync engine.
**Push is never load-bearing.** A calendar that could not register is polled every fifteen minutes,
and an account without push is synced on the same schedule. To ask for registration immediately:
```bash
docker compose exec php php bin/console app:calendar:push
```
## OneDrive is a different registration
Attaching files from and saving attachments to OneDrive goes through the same API but needs
permissions the mail registration does not carry — `Files.ReadWrite` and `offline_access` — and its
own redirect URI at `/integrations/oauth/oneDrive/callback`. The admin screen offers to reuse the
mail credentials for it, which copies the client ID and secret across server-side; the copy does
**not** grant the extra permission, so those still have to be added in the app registration. Its
setup steps are in **Admin → Integrations**, on the OneDrive entry.
## Things that bite
**The tenant value and the supported account types must agree**, or consent fails with
`AADSTS50194` — at the user's first sign-in, not at setup. This is the single most common Microsoft
misconfiguration here.
**Copy the secret's Value, not its ID.** Azure shows both in the same table and only the Value is
usable; it is displayed once and cannot be retrieved afterwards, only replaced.
**Adding a permission does not upgrade tokens that already exist.** A user who connected before you
added `Calendars.ReadWrite`, `Contacts.ReadWrite` or `MailboxSettings.ReadWrite` holds a token that
does not carry it, and no amount of waiting changes that. The account has to sign in again so a
fresh consent issues a new token — the reconnect button in **Settings → Account health** does that without
removing the account, and `app:graph:diagnose` says so explicitly when it finds the gap.
**An organisation that approves apps for its users refuses every sign-in after an upgrade that
adds a permission.** In a tenant where users may not consent to apps themselves, an administrator
approved plMail once, for the permissions it asked for then. A plMail version that asks for one
more (`Contacts.ReadWrite`, when contact sync arrived) is refused at sign-in, mail included, with
`AADSTS65001` or `AADSTS90094`, until the administrator approves again: **Microsoft Entra admin
centre → Enterprise applications → plMail → Permissions → Grant admin consent**. Do it before
upgrading, or before anyone reconnects. The sign-in error tells the user to ask their administrator,
**Admin → Integrations → Microsoft mail sign-in** carries the same warning, and so does the
reconnect offer in **Settings → Contacts**. Personal Microsoft accounts and tenants where users
approve apps themselves are not affected.
**Identity working while every mail endpoint fails is not a credentials problem.** It usually means
the Microsoft account has no Outlook mailbox provisioned at all, which happens with accounts created
from an external address. Confirm at outlook.live.com: landing in a setup prompt rather than an
inbox is the tell, and no configuration on this side fixes it.
**Master categories are not covered by `Mail.ReadWrite`.** They are a separate resource and need
`MailboxSettings.ReadWrite`. The symptom is a perfectly healthy account whose labels never reach
Outlook.
**A lapsed Graph subscription cannot be revived.** Microsoft will not extend one that has already
expired; only a fresh subscription works, which is what the renewal sweep creates. This is why the
renewal threshold is twelve hours against a three-day lifetime rather than something tighter.
**`http://` and `localhost` notification URLs are refused**, and plMail checks that locally before
calling Graph so you get one log line naming the missing setting instead of a repeated remote
validation failure.
**The redirect URI cannot be changed after people have connected.** Getting the public address right
before anyone signs in is cheaper than migrating everyone afterwards.