# Groupware

# Groupware

- [Calendar / CalDAV](/link/1035)
- [Contacts / CardDAV](/link/1036)
- [Contacts Interaction](/link/1037)
- [Mail](/link/1038)
- [Out-of-office feature](/link/1039)
- [Troubleshooting](/link/1040)


# Calendar / CalDAV

## Calendar server settings

The calendar server can be configured on the Groupware admin settings page. You can globally disable sending invitation emails for events, generating the built-in birthday calendar, and sending email notifications about upcoming events.

![](https://docs.cocobook.com/uploads/images/gallery/2026-10/settings-calendar-server.png)

> *New in version 30.0.0:* The section will be hidden if no app makes use of the CalDAV backend.

Starting from Nextcloud 30, the calendar server settings section will be hidden if no app uses the CalDAV backend. Install and enable an appropriate app to show the section again, e.g. [Calendar](https://apps.nextcloud.com/apps/calendar) or [Tasks](https://apps.nextcloud.com/apps/tasks).

## Events

You can customize the events user interface.

### Hide export buttons

By default users can export their calendar data from the event editor. Admins can disable this feature:

    sudo -E -u www-data php occ config:app:set calendar hideEventExport --value=yes

## Invitations

Nextcloud can send invitations for event attendees if this option is activated. Be sure to have configured the email server first so that the invitations go through. See [Email](/link/929).

You must also make sure the "Send invitations to attendees" setting is activated in the admin setting groupware section for the emails to be sent.

Administrators can disable the sending of invitations to external participants with the following command:

    sudo -E -u www-data php occ config:app:set dav caldav_external_attendees_disabled --value yes

This prevents invitations from being sent to attendees outside the instance and hides external contacts from the invitee search.

## Birthday calendar

Contacts that have a birthday date filled are automatically added as events to a special Birthday calendar. If you deactivate this option, all users will no longer have this calendar.

When activating this option, users birthday calendars won't be available right away because they need to be generated by a background task. See [Using the occ command](/link/937) section DAV commands.

## Reminder notifications

Nextcloud handles sending notifications for events.

Nextcloud currently handles two types of reminder notifications: Built-in Nextcloud notifications and email notifications. For the emails to be send, you'll need a configured email server. See [Email](/link/929).

Make sure the "Send notifications for events" and the "Enable notifications for events via push" are activated in the admin setting groupware section for this feature to work.

### Background jobs

Running background jobs can be an expensive task when there are a large number of events, reminders, event sharees and attendees. However, this needs to happen often enough so that the notifications are sent on time. To accomplish this you should use a dedicated `occ` command that runs more often than the standard `cron` system:

    # crontab -u www-data -e
    */5 * * * * php -f /var/www/nextcloud/occ dav:send-event-reminders

See [Using the occ command](/link/937) section Dav commands.

You'll also need to change the sending mode from `background-job` to `occ`:

    sudo -E -u www-data php occ config:app:set dav sendEventRemindersMode --value occ

If you don't use this dedicated command, the reminders will just be sent as soon as possible when the background jobs run.

## Event alarm types

Nextcloud allows users to set notification and email reminders for events. Admins can enforce one of the two options:

    occ config:app:set calendar forceEventAlarmType --value=EMAIL

Allowed values are `EMAIL` (email) and `DISPLAY` (notification).

> **提示**
>
> This only enforces alarm types for events created with the Nextcloud Calendar. This setting has no influence for other connected applications.

## FreeBusy

When logged-in, Nextcloud can return FreeBusy information for all users of the instance, to know when they are available so that you can schedule an event at the right time. If you don't wish for users to have this capability, you can disable FreeBusy for the whole instance with the following setting:

    sudo -E -u www-data php occ config:app:set dav disableFreeBusy --value yes

## Subscriptions

### Custom public calendars

In addition to the public holiday calendars, it is possible to define your own calendar. They act in the same way as the holiday calendars and can be configured with the following command:

    sudo -E -u www-data php occ config:app:set calendar publicCalendars --value '[{"name":"My custom calendar","source":"http://example.com/example.ics"}]'

The setting is specified as a JSON array of objects with the following options:

- `name` - name of the calendar in the listing
- `source` - URL of the calendar's ICS file
- `displayName` - optional, to overwrite the name of the subscribed calendar
- `description` - optional, description in the listing
- `authors` - optional, copyrights and so on

### Refresh rate

Calendar subscriptions are cached on server and refreshed periodically. If the calendar server provides a [refresh interval](https://icalendar.org/New-Properties-for-iCalendar-RFC-7986/5-7-refresh-interval-property.html), it is respected. Otherwise the default refresh rate is one day.

To set up a different default refresh rate for calendars without server side refresh rates, change the `calendarSubscriptionRefreshRate` option:

    sudo -E -u www-data php occ config:app:set dav calendarSubscriptionRefreshRate --value "PT6H"

Where the value is a [DateInterval](https://www.php.net/manual/dateinterval.construct.php), for instance with the above command all of the Nextcloud instance's calendars would be refreshed every 6 hours.

### Allow subscriptions on local network

Because of security issues, Nextcloud forbids subscriptions from local network hosts. If you need to allow this, change the following parameter to:

    sudo -E -u www-data php occ config:app:set dav webcalAllowLocalAccess --value yes

## Federated calendar shares

> *New in version 32.0.0*

> *Changed in version 33.0.0:* Federated calendar shares are now read/write.

Nextcloud supports creating federated calendar shares. A user is able to share a calendar with a remote user on a federated instance. Starting with Nextcloud 33, remote users are able to create, edit, and delete events inside the shared calendar. In Nextcloud 32, shares were read-only.

The feature can be optionally disabled through an app config. Run the following command to disable creating new federated calendar shares for all users:

    sudo -E -u www-data php occ config:app:set dav enableCalendarFederation --type=bool --value=false

Note that existing shares will be deleted when the feature is disabled as they will fail to sync.

## Trash bin

Nextcloud supports a calendar, events and tasks trash bin.

The default delay before objects are purged from the trash bin is 30 days. A background job runs every 6 hours to clean up expired objects.

To set up a different retention period, change the `calendarRetentionObligation` option:

    sudo -E -u www-data php occ config:app:set dav calendarRetentionObligation --value=2592000

Where the value is the number of seconds for the period. Setting the value to `0` disables the trash bin.

## Resources and rooms

The Nextcloud CalDAV backend supports resources and rooms. Resources and rooms can be booked for appointments, and the system will schedule them so they can only be used once at a time. Those resources and rooms have to be provided by an app that provides a backend for this.

Once a backend app is installed, the app typically allows admins, or even users, to define the resources, but this is subject of the specific implementation.

Nextcloud periodically queries all registered backends, therefore new/updated resources and rooms will show with a delay.

### Known backends

- [Calendar Resource Management](https://github.com/nextcloud/calendar_resource_management): database backend with CLI configuration for admins

## Rate limits

Nextcloud rate limits the creation of calendars and subscriptions if too many items are created within a short time frame. The default is 10 calendars or subscriptions per hour. This can be customized as follows:

    # Set limit to 15 items per 30 minutes
    sudo -E -u www-data php occ config:app:set dav rateLimitCalendarCreation --type=integer --value=15
    sudo -E -u www-data php occ config:app:set dav rateLimitPeriodCalendarCreation --type=integer --value=1800

Additionally, the maximum number of calendars and subscriptions a user may create is limited to 30 items. This can be customized too:

    # Allow users to create 50 calendars/subscriptions
    sudo -E -u www-data php occ config:app:set dav maximumCalendarsSubscriptions --type=integer --value=50

or:

    # Allow users to create calendars/subscriptions without restriction
    sudo -E -u www-data php occ config:app:set dav maximumCalendarsSubscriptions --type=integer --value=-1

## Example event

> *New in version 32.0.0*

When a user logs in for the first time an example event is created in their personal calendar.

This feature is enabled by default and is controlled by the `create_example_event` app config.

As an admin, you can disable the creation of the example event. It is also possible to replace the default event with a custom one.

To disable the creation of the example event for new users:

1.  Navigate to the Groupware settings in the admin settings.
2.  Scroll down to the "Example content" section.
3.  Disable the "Add example event ..." setting with the checkbox

It can also be toggled from the command line:

    sudo -E -u www-data php occ config:app:set dav create_example_event --value=no

To replace the built-in default event with a custom one:

1.  Navigate to the Groupware settings in the admin settings.
2.  Press the "Import calendar event" button.
3.  Choose an ICS file to be imported.

> **提示**
>
> The start and end date will be overwritten with dates in the future when a custom event is supplied to ensure that the user sees the event.

It is also possible to revert to the default built-in event by pressing the "Reset to default" button next to the import button.

## Data retention

> *New in version 26.0.0*

You can configure how long Nextcloud keeps some of the calendar sync tokens.

### Sync tokens

The CalDAV backend keeps track of any modifications of calendars. That is anything added, modified or removed. The data is used for differential synchronization of offline clients like Thunderbird. At a certain point in time, the data can be considered outdated assuming there will be no more client needing it. This can help keep the database table calendarchanges small:

    sudo -E -u www-data php occ config:app:set totalNumberOfSyncTokensToKeep --value=30000

The default is keeping 10,000 entries. This option should be set adequate to the number of users. E.g. on an installation with 5000 active synced calendars the system would only keep an average of 10 changes per calendar. This will lead to premature data deletion and synchronization problems.

> **注意**
>
> This setting will also influence [CardDAV data retention](/link/1036).


# Contacts / CardDAV

Nextcloud ships a CardDAV backend for users to store and share their address books and contacts.

## System Address Book

> *Changed in version 27.0.0:* The system address book is now accessible to all Nextcloud users

Nextcloud maintains a read-only address book containing contact information of all users of the instance.

Disabled users are removed from this address book.

You can disable or enable access to the system address book by using the administration interface or with a command line command.

Please note that this does not influence [Federated sharing](/link/952).

### Command Line

Run `occ config:app:set dav system_addressbook_exposed --value="no"` to disable access to the system address book for all users.

### Administration interface

Navigate to *Administration Settings* -\> *Groupware* -\> *System Address Book* section and toggle the *Enable system address book* option.

> **注意**
>
> If clients have already connected to the CalDAV endpoint, the clients might experience sync issues after system address book access was disabled. This can often be remedied by choosing a different default address book on the client and forcing a resync.

### Privacy and User Property Scopes

Contact information in the system address book is taken from users' [profile information](/link/1022). Profile properties are only written to the system contact if the [scope](/link/1022) is set to *Local* or higher.

Users who set all their property scopes to *Private* are removed from the system address book and therefore not seen by other users.

[File sharing settings](/link/951) controls the enumeration of other users.

- If username autocompletion is not allowed, the system address book will only show user's own system contact but no other contacts.
- If username autocompletion is allowed, users will see contact cards for all other users.
  - If autocompletion is limited to users within the same groups, users will see contact cards for other users in shared groups.
  - If autocompletion is limited to matching phone numbers, the system address book will only show user's own system contact but no other contacts.
  - If autocompletion is limited to users within the same groups **and** matching phone numbers, users will see contact cards for other users in shared groups.

### Address Book Sync

The address book is updated automatically with every added, modified, disabled or removed user. Admins can also trigger a full rewrite of the address book [with occ](/link/939).

## Shared items

> *New in version 5.5.0:* Nextcloud 25 or newer

For this feature, the shipped [related resources app](https://apps.nextcloud.com/apps/related_resources) needs to be enabled.

## Rate limits

Nextcloud rate limits the creation of address books and how many can be created in a short period of time. The default is 10 address books per hour. This can be customized as follows:

    # Set limit to 15 items per 30 minutes
    sudo -E -u www-data php occ config:app:set dav rateLimitAddressBookCreation --type=integer --value=15
    sudo -E -u www-data php occ config:app:set dav rateLimitPeriodAddressBookCreation --type=integer --value=1800

Additionally, the maximum number of address books a user may create is limited to 10 items. This can be customized too:

    # Allow users to create 50 addressbooks
    sudo -E -u www-data php occ config:app:set dav maximumAdressbooks --type=integer --value=50

or:

    # Allow users to create address books without restriction
    sudo -E -u www-data php occ config:app:set dav maximumAdressbooks --type=integer --value=-1

## Example contact

> *New in version 32.0.0*

When a user logs in for the first time an example contact is created in the user's address book.

This feature is enabled by default and is controlled by the `enableDefaultContact` app config.

To disable the example contact feature:

1.  Navigate to the Groupware settings in the admin settings.
2.  Scroll down to the "Example content" section.
3.  Disable the "Add example contact ..." setting with the checkbox

It can also be toggled from the command line:

    sudo -E -u www-data php occ config:app:set dav enableDefaultContact --value=no

If you want to set a specific contact that should be created.

4.  Press the "Import contact" button.
5.  Choose a vCard file (.vcf) that should be imported as an example contact.

Switching back to the default example contact provided by nextcloud is possible by pressing the "Reset to default" button next to the import button.

## Data retention

> *New in version 26.0.0*

You can configure how long Nextcloud keeps some of the contacts sync tokens.

### Sync tokens

The CardDAV backend keeps track of any modifications of address books. That is anything added, modified or removed. The data is used for differential synchronization of offline clients like Thunderbird. At a certain point in time, the data can be considered outdated assuming there will be no more client needing it. This can help keep the database table addressbookchanges small:

    sudo -E -u www-data php occ config:app:set totalNumberOfSyncTokensToKeep --value=30000

The default is keeping 10,000 entries. This option should be set adequate to the number of users. E.g. on an installation with 5000 active synced addressbooks the system would only keep an average of 10 changes per sync. This will lead to premature data deletion and synchronization problems.

> **注意**
>
> This setting will also influence [CalDAV data retention](/link/1035).


# Contacts Interaction

The Contacts Interaction app automatically tracks which people a user has recently interacted with and provides this data as a read-only CardDAV address book called **Recently contacted**. This enables autocomplete suggestions in sharing dialogs, email composition, calendar invitations and other places that query the user's address books — even for people who are not saved as explicit contacts.

The app is shipped with Nextcloud and enabled by default. It can be disabled.

## How interactions are tracked

The app listens for `ContactInteractedWithEvent` events dispatched by other Nextcloud apps. The following apps dispatch this event:

- **File sharing**: When a user creates a share with another local user, an email address or a federated remote user.
- **Calendar**: When a user shares a calendar with another user.
- **Mail**: When a user sends an email.

Any app can integrate by dispatching a `ContactInteractedWithEvent` with at least one identifier: a Nextcloud user ID, an email address or a federated cloud ID.

When an interaction is recorded, the app first checks whether the contacted person already exists in one of the user's regular address books. If a match is found, no entry is created in the recently contacted address book since the person is already a known contact. Self-interactions (where the user interacts with themselves) are also ignored.

For new contacts, a minimal vCard is generated containing:

- `FN` (display name): Resolved from the Nextcloud user profile if the person is a local user, falling back to the email address or federated cloud ID.
- `EMAIL`: Included when an email address is known.
- `CLOUD`: Included when a federated cloud ID is known.
- `CATEGORIES`: Set to `Recently contacted`, which allows the Contacts app to identify entries from this address book and offer users the option to copy them to a regular address book.

If the same person is contacted again, the existing entry's timestamp is updated rather than creating a duplicate.

## The recently contacted address book

Each user's recently contacted address book is accessible via CardDAV at:

    /remote.php/dav/addressbooks/users/{userId}/z-app-generated--contactsinteraction--recent/

The `z-app-generated` prefix ensures the address book sorts after user-created address books. Users cannot create their own address books with this reserved prefix.

The address book is **read-only** and **not shareable**. Users cannot create, modify or delete entries. Entries are only removed automatically by the cleanup job or when a user account is deleted.

The address book is visible in:

- **CardDAV clients**: Any client syncing with the user's Nextcloud (e.g., Thunderbird, macOS Contacts, DAVx5) will see the address book.
- **Nextcloud Contacts**: The address book and its entries appear in the Contacts UI if the Contacts app is enabled. Contacts from this address book can be copied to a regular address book.
- **Autocomplete**: Entries are available for recipient suggestions in sharing dialogs and other places across the Nextcloud web interface.

## Data retention

A background job runs every 24 hours and removes entries that have not been updated within the last 7 days. Both the retention period and the cleanup interval are fixed and cannot be configured.

> **提示**
>
> The cleanup job depends on the Nextcloud background job system. Make sure cron is configured correctly for your instance. See [Background jobs](/link/924).

## User deletion

When a user account is deleted, all of that user's recently contacted entries are automatically removed from the database.


# Mail

## Configuration

### Anti-abuse alerts

The app can write alerts to the logs when users send messages to a high number of recipients or sends a high number of messages for a short period of time. These events might indicate that the account is abused for sending spam messages.

To enable anti-abuse alerts, you'll have to set a few configuration options [via occ](/link/937) .

    # Turn alerts on
    occ config:app:set mail abuse_detection --value=on
    # Turn alerts off
    occ config:app:set mail abuse_detection --value=off

    # Alert when 50 or more recipients are used for one single message
    occ config:app:set mail abuse_number_of_recipients_per_message_threshold --value=50

    # Alerts can be configured for three intervals: 15m, 1h and 1d
    # Alert when more than 10 messages are sent in 15 minutes
    occ config:app:set mail abuse_number_of_messages_per_15m --value=10
    # Alert when more than 30 messages are sent in one hour
    occ config:app:set mail abuse_number_of_messages_per_1h --value=30
    # Alert when more than 100 messages are sent in one day
    occ config:app:set mail abuse_number_of_messages_per_1d --value=100

### Attachment size limit

Admins can prevent users from attaching large attachments to their emails. Users will be asked to use link shares instead.

    'app.mail.attachment-size-limit' => 3*1024*1024,

The unit is bytes. The example about with limit to 3MB attachments. The default is 0 bytes which means no upload limit.

### Background sync interval

Configure how often Mail keeps users' mailboxes updated in the background in seconds. Defaults to 3600, minimum 300.

    'app.mail.background-sync-interval' => 7200,

### Disable TLS verification for IMAP/SMTP

Turn off TLS verification for IMAP/SMTP. This happens globally for all accounts and is only needed in edge cases like with email servers that have a self-signed certificate.

    'app.mail.verify-tls-peer' => false

### Google OAuth

This app can allow users to connect their Google accounts with OAuth. This makes it possible to use accounts without 2FA or app password.

1.  [Create authorization credentials](https://developers.google.com/identity/protocols/oauth2/web-server#prerequisites). You will receive a client ID and a client secret.
2.  Open the Nextcloud settings page. Navigate to *Groupware* and scroll down to *Gmail integration*. Enter and save the client ID and client secret.

### Local IMAP and SMTP servers

By default, Nextcloud does not allow local hostnames and IP addresses as remote servers. This includes IMAP, SMTP and Sieve servers like `localhost`, `mx.local` and `10.0.0.3`. This check can be disabled with via `config/config.php`.

    'allow_local_remote_servers' => true,

### Timeouts

Depending on your mail host, it may be necessary to increase your IMAP and/or SMTP timeout threshold. Currently IMAP defaults to 5 seconds and SMTP defaults to 20 seconds. They can be changed as follows:

#### IMAP timeout

    'app.mail.imap.timeout' => 5

#### SMTP timeout

    'app.mail.smtp.timeout' => 20

#### Sieve timeout

    'app.mail.sieve.timeout' => 5

### Use php-mail for sending mail

> **注意**
>
> Support for using php-mail was removed in version 4.4 of the mail app!

You can use the php-mail function to send mails. This is needed for some web hosters (1&1 (1und1)).

    'app.mail.transport' => 'php-mail'

## Account delegation

The Mail app supports account delegation if the delegation is handled by the mail server. That means the mail server has to accept emails sent from an alias address.

In mailcow, for example, the setting is called *Also allowed to send as user*.

> **注意**
>
> Unless paired with shared *Sent* mailboxes or handled otherwise by the mail server, sent messages will be stored in the sender's personal *Sent* mailbox.

## Snooze and scheduled sending

> **提示**
>
> If AJAX is selected for cron job execution in the admin settings, the snooze feature and scheduled sending are deactivated because of unreliable execution.

## XOAUTH2 Authentication with Microsoft Azure AD

> *New in version 3.0.0*

The Mail app supports XOAUTH2 authentication with hosted Microsoft Outlook accounts. An app has to be registered in the Microsoft Azure web interface and its credentials have to be supplied to the Nextcloud instance. You can find relevant settings in the Groupware section of the admin settings.

**Step 1: Open the Azure AD Dashboard**

Visit the [Azure portal](https://portal.azure.com) and navigate to the Azure AD dashboard.

![](https://docs.cocobook.com/uploads/images/gallery/2026-10/1.png)

**Step 2: Create a new app registration**

![](https://docs.cocobook.com/uploads/images/gallery/2026-10/2.png)

Chose a name, allow organizational and personal Microsoft accounts. Configure a web app and copy the redirect URI from the groupware settings of your Nextcloud instance. Have a look at step 8 on where to find the redirect URI. Finally, click on register to proceed.

![](https://docs.cocobook.com/uploads/images/gallery/2026-10/3.png)

**Step 3: Copy the client ID**

This ID will be needed later for the Nextcloud settings.

![](https://docs.cocobook.com/uploads/images/gallery/2026-10/4.png)

**Step 4: Create a new client secret**

![](https://docs.cocobook.com/uploads/images/gallery/2026-10/5.png)

Chose a descriptive name for the secret and set the an appropriate expiration date. Click on add to create the secret.

![](https://docs.cocobook.com/uploads/images/gallery/2026-10/6.png)

**Step 5: Copy the client secret**

Copy the client secret manually or by clicking on the copy button. You can find it in the value column. The secret will also be needed later for the Nextcloud settings.

![](https://docs.cocobook.com/uploads/images/gallery/2026-10/7.png)

**Step 6: Configure Nextcloud**

Open the groupware settings in the Nextcloud admin settings and fill in the client ID and client secret. Leave the tenant ID as is (common). You can also find the redirect URI here. Click on save to proceed.

> **注意**
>
> Using a custom tenant ID is not covered by this guide. Only configure it if you are an expert and changed the supported account types in step 2.

![](https://docs.cocobook.com/uploads/images/gallery/2026-10/8.png)

**Step 7: Connect Microsoft Outlook accounts**

Congratulations! You are now able to use hosted Microsoft Outlook accounts in the Mail app. Use your Microsoft account email and any password when adding your account. The password will be discarded and you will be prompted with a Microsoft consent popup to log in to your account.

![](https://docs.cocobook.com/uploads/images/gallery/2026-10/9.png)

![](https://docs.cocobook.com/uploads/images/gallery/2026-10/10.png)

## Mailbox Share

Users can share mailboxes with each other. So far, there is no UI for users to change the ACL in the Mail app, but if you want to use it, you need to enable it on the IMAP sever and configure the shares there.

## User Interface Preference Defaults

> *New in version 5.2:* Nextcloud 30 or newer

The Mail app allows administrators to set default user interface preferences for all users, these preferences can be changed by the user afterwards. This can be useful to ensure a consistent experience across the application.

![User Interface Preference Defaults](https://docs.cocobook.com/uploads/images/gallery/2026-10/settings-mail-ui-defaults.png)

## LLM Processing

The Mail app can optionally use large language models to process emails and offer assistance features like thread summaries, smart replies, event agendas and follow-up reminders.

> **提示**
>
> The supported languages depend on the used large language model.

> **提示**
>
> A fast text processing integration like <https://apps.nextcloud.com/apps/integration_openai> is required for best results.

The feature can be enabled in the Mail administration settings.

Administration settings \> Groupware \> Mail app \> Enable text processing through LLMs

## Thread Summary

> *Changed in version 3.6.0:* Nextcloud 26 or newer This configuration option was merged into [LLM Processing](/link/1038)

The mail app supports summarizing message threads that contain 3 or more messages.

> **注意**
>
> [A text generation AI integration](https://apps.nextcloud.com/apps/integration_openai) should be already in place to enable this feature.

The feature is opt-in, it is disabled by default and can be enabled in mail administration settings.

Administration settings \> Groupware \> Mail app \> Enable thread summary

## Follow-up reminders

> *New in version 4.0:* Nextcloud 30 or newer

The Mail app will automatically remind users when their outgoing emails remain unanswered for multiple days. Each sent email will be analyzed by an AI to check whether a reply is expected.

The feature can be enabled through the global [LLM Processing](/link/1038) setting.

## Translation

> *New in version 4.2:* Nextcloud 30 or newer

The mail app can optionally provide translations for messages if the [translation API](/link/993) is enabled.

## User migration

> *New in version 5.9:* Nextcloud 30 or newer

> **说明**
>
> The [User Migration App](https://apps.nextcloud.com/apps/user_migration) must be installed and enabled on both instances.

To migrate user data from one Nextcloud instance to another, use the User Migration App via the `occ user:export` or `occ user:import` command line tool.

The Mail app can migrate the following data:

- Manually added mail accounts and their respective account settings (e.g., display name, signature, quick actions, ...)
- Configured internal addresses
- Configured trusted senders
- S/MIME certificates and private keys
- General app settings like the order of mail accounts

> **提示**
>
> Provisioned mail accounts are not migrated, as they are expected to be re-provisioned on the new instance.

> **提示**
>
> The User Migration App is **not** a backup solution, as existing data is not being removed before the import process.

See the [User Migration App](https://apps.nextcloud.com/apps/user_migration) on the Nextcloud App Store for more information.


# Out-of-office feature

> *New in version 28.0.0*

The out-of-office feature allows users to schedule an out-of-office period including a status and message that is integrated with other apps such as Nextcloud Mail. Please refer to the user documentation for more information about the feature itself. It may be disabled globally by admins.

The feature relies on users to configure their preferred calendar time zones correctly. However, if a user does not configure their time zone, the default time zone of the server is used. It can be configured by setting `default_timezone` in the config.php file of your Nextcloud server. The configuration value accepts IANA identifiers like `Europe/Berlin` and defaults to `UTC`. Please refer to the Nextcloud configuration section for more information about the value.

To disable the out-of-office feature for all users the `hide_absence_settings` app configuration value of the dav app has to be set to yes. This can be achieved by running the following command on your server:

    occ config:app:set --value=yes dav hide_absence_settings

> **提示**
>
> Out-of-office periods that were scheduled before the feature was disabled will not be deleted. Disabling it will only hide the feature from the user interface. If the feature is enabled again, the periods will be visible again.

Set the value for hide_absence_settings to no or delete the configuration option entirely to enable the feature again. The following command can be used to do so:

    occ config:app:set --value=no dav hide_absence_settings

# Troubleshooting

## Calendar

### Missing Shared Calendars

**Problem:**  
A user should have access to a shared calendar, but the calendar is not displayed in Nextcloud Calendar or other CalDAV clients (e.g., DAVx⁵ or Thunderbird).

**Affected Versions:**  
- Nextcloud Server 31.0.5 and below
- Nextcloud Server 30.0.11 and below

**Possible Reason:**  
A bug in previous versions of Nextcloud Server could mistakenly add a calendar unshare instead of removing the share permission. For example, a user has read access through a group membership, and the owner grants permission to a single user to modify a calendar. When the modify permission is removed, an unshare record is incorrectly created.

**Troubleshooting Steps:**

1.  **Check for Hidden Calendars:**  
    It’s possible for a user to hide a calendar. Please check in Nextcloud Calendar if the missing calendar is listed in the "hidden" section. If it is, check the box in front of the calendar to enable it again.

2.  **List Calendar Shares:**  
    Run the command `occ dav:list-calendar-shares <uid>` to list all shares for a user. Look for lines with the Calendar URI/Calendar Name of the missing calendar and Permissions = Unshare. If such a line exists, but the user should have access, you have three options:

<!-- -->

1.  **Create a User Share and Remove It Again:**  
    In most cases, sharing the calendar with the user again (as an individual/user share) will correct the state in the database.

2.  **Remove All Calendar Unshares for a User:**  
    Run `occ dav:clear-calendar-unshares <uid>`.

3.  **Delete Specific Unshares:**  
    Some users may have many calendar unshares, so it might be easier to delete only the unwanted unshare. The `Share Id` refers to the ID of a row in the `oc_dav_shares` database table. Delete the row with the matching ID to remove the unshare.

**Why isn't there an automated migration to correct the problem?**  
Unsharing a calendar is a feature, and with the given information, we cannot determine if a calendar was unshared intentionally or as a result of the bug.

## Contacts

### Unable to update contacts or events

If you get an error like:

`PATCH https://example.com/remote.php/dav HTTP/1.0 501 Not Implemented`

it is likely because of a misconfigured web server. Please refer to [Troubleshooting WebDAV](/link/1071) for troubleshooting steps.

## Mail

### Autoconfig for your mail domain fails

If autoconfiguration for your domain fails, you can create an autoconfig file and place it as `https://autoconfig.yourdomain.tld/mail/config-v1.1.xml`. For more information please refer to [Mozilla's documentation](https://wiki.mozilla.org/Thunderbird:Autoconfiguration:ConfigFileFormat).

### Database insert problems on MySQL

If the mail app fails to insert new rows for messages (oc_mail_messages), recipients (oc_mail_recipients) or similar tables, you are possibly not using the 4 byte support.

See [Enabling MySQL 4-byte support](/link/912) for how to update your database configuration.

### Export threading data

If you encounter an issue with threading, e.g. messages that belong to the same conversation thread don't show up as one, you can export the data the algorithm will use to build threads. We are dealing with sensitive data here, but the command will optionally redact the data with the `--redact` switch. The exported data will then only keep the original database IDs, the rest of the data is randomized. This format does not the export message details, it still contains metadata about how many messages you have and how they relate. Please consider this before posting the data online.

    sudo -E -u www-data php occ mail:account:export-threads 1393

> **提示**
>
> 1393 represents the [account ID](/link/1040).

The output will look similar to this:

    [
        {
            "subject": "83379f9bc36915d5024de878386060b5@redacted",
            "id": "2def0f3597806ecb886da1d9cc323a7c@redacted",
            "references": [],
            "databaseId": 261535
        },
            {
            "subject": "Re: 1d4725ae1ac4e4798b541ca3f3cdce6e@redacted",
            "id": "ce9e248333c44a5a64ccad26f2550f95@redacted",
            "references": [
                "bc95cbaff3abbed716e1d40bbdaa58a0@redacted",
                "8651a9ac37674907606c936ced1333d7@redacted",
                "4a87e94522a3cf26dba8977ae901094d@redacted",
                "a3b30430b1ccb41089170eecbe315d3a@redacted",
                "8e9f60369dce3d8b2b27430bd50ec46d@redacted",
                "46cfa6e729ff329e6ede076853154113@redacted",
                "079e7bc89d69792839a5e1831b1cbc80@redacted",
                "079e7bc89d69792839a5e1831b1cbc80@redacted"
            ],
            "databaseId": 262086
        },
        {
            "subject": "Re: 1d4725ae1ac4e4798b541ca3f3cdce6e@redacted",
            "id": "8dd0e0ef2f7ab100b75922489ff26306@redacted",
            "references": [
                "bc95cbaff3abbed716e1d40bbdaa58a0@redacted",
                "8651a9ac37674907606c936ced1333d7@redacted",
                "4a87e94522a3cf26dba8977ae901094d@redacted",
                "a3b30430b1ccb41089170eecbe315d3a@redacted",
                "8e9f60369dce3d8b2b27430bd50ec46d@redacted",
                "46cfa6e729ff329e6ede076853154113@redacted",
                "079e7bc89d69792839a5e1831b1cbc80@redacted",
                "ce9e248333c44a5a64ccad26f2550f95@redacted",
                "ce9e248333c44a5a64ccad26f2550f95@redacted"
            ],
            "databaseId": 262087
        }
    ]

It's recommended practice to pipe the export into a file, which you can later share with the Mail app community and developers:

    sudo -E -u www-data php occ mail:account:export-threads 1393 | gzip -c > /tmp/nextcloud-mail-threads-1393.json.gz

### Get account IDs

For many troubleshooting instructions you need to know the id of a mail account. You can acquire this through the database, but it's also possible to utilize the account export command of [occ](/link/937) if you know the UID of the user utilizing the mail account:

    sudo -E -u www-data php occ mail:account:export user123

The output will look similar to this:

    Account 1393:
    - E-Mail: christoph@domain.com
    - Name: Christoph Wurst
    - IMAP user: christoph
    - IMAP host: mx.domain.com:993, security: ssl
    - SMTP user: christoph
    - SMTP host: mx.domain.com:587, security: tls

In this example, `1393` is the account ID.

### Issues connecting to Outlook.com

If you can not access your Outlook.com account try to enable the [Two-Factor Verification](https://account.live.com/proofs/Manage) and set up an [app password](https://account.live.com/proofs/AppPassword), which you then use for the Nextcloud Mail app.

### Logging the IMAP/SMTP/Sieve connections

The Nextcloud Mail app offers an extensive logging system to make it easier identifying and tracking down bugs. As this may include sensitive data, be sure to remove or mask them before posting them publicly.

#### Per mail account

> *New in version 5.1.0:* Nextcloud 30 or newer

Starting with version 5.1.0 of the mail app, you can enable logging of outgoing IMAP/SMTP/Sieve connections limited to a specific mail account. As that saves a lot of resources on your system, this is the preferred method for debugging issues regarding IMAP/SMTP/Sieve connections.

First, you need to get the accountId for the mail account you like to enable debug logging on. Please see [Get account IDs](/link/1040) for more.

Once you know the accountId of the mail account in question, you can use it to enable debug logging by running the following command on the server:

    sudo -E -u www-data php occ mail:account:debug <accountId> --on

All subsequent outgoing connections made by the mail app will then be written to the `data` directory. The file naming follows the following format: `mail-{{userId}}-{{accountId}}-{{protocol}}.log` (e.g., mail-admin-49-imap.log).

The debug logging for that specific account can be disabled once you've collected the necessary data by running the following command on the server:

    occ mail:account:debug <accountId> --off

#### Globally

This enables logging of the IMAP/SMTP/Sieve connections for **all** mail accounts configured on the server. This should be used with caution as it can put a lot of strain on large environments.

> *New in version 5.1.0:* Nextcloud 30 or newer

To enable the global debug logging on versions 5.1.0 and above, just run the following command on the server:

    sudo -E -u www-data php occ config:system:set app.mail.debug --value true --type bool

All subsequent outgoing connections made by the mail app will then be written to the `data` directory. The file naming follows the following format: `mail-{{userId}}-{{accountId}}-{{protocol}}.log` (e.g., mail-admin-49-imap.log).

The global debug logging can be disabled once you've collected the necessary data by running the following command on the server:

    sudo -E -u www-data php occ config:system:set app.mail.debug --value false --type bool

> **提示**
>
> The following steps only apply to version 1.6.2 up to 5.0.8. Restrict logging of outgoing connections to a specific mail account is not available there.

> *New in version 1.6.2:* Nextcloud 20 or newer

To enable the global debug logging, it's necessary to enable both the debug mode as well as debug logging for the whole nextcloud instance by running the following commands on the server:

    sudo -E -u www-data php occ config:system:set debug --value true --type bool
    sudo -E -u www-data php occ config:system:set loglevel --value 0 --type int

All subsequent outgoing connections made by the mail app will then be written to the `data` directory. The file naming follows the following format: `horde_{{protocol}}.log` (e.g., horde_imap.log).

Once you've collected the necessary data, it's highly recommended to disable the debug mode as well as resetting the loglevel to the default value by running the following commands:

    sudo -E -u www-data php occ config:system:set debug --value false --type bool
    sudo -E -u www-data php occ config:system:set loglevel --value 2 --type int

### Timeout and other connectivity issues

You can use OpenSSL to test and benchmark the connection from your nextcloud host to the IMAP/SMTP host.:

    openssl s_time -connect imap.domain.tld:993

The output should look similar to this:

    Collecting connection statistics for 30 seconds
    ***************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************

    483 connections in 0.94s; 513.83 connections/user sec, bytes read 0
    483 connections in 31 real seconds, 0 bytes read per connection


    Now timing with session id reuse.
    starting
    *****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************

    497 connections in 0.97s; 512.37 connections/user sec, bytes read 0
    497 connections in 31 real seconds, 0 bytes read per connection

### Manual account synchronization and threading

To troubleshoot synchronization or threading problems it's helpful to run the sync from the command line while the user does not use the web interface (reduces chances of a conflict):

    sudo -E -u www-data php occ mail:account:sync -vvv 1393

> **提示**
>
> 1393 represents the [account ID](/link/1040).

The command offers a `--force` option. Use it wisely as it doesn't perform the same path a typical web triggered sync request would do.

The output will look similar to this:

    [debug] Skipping mailbox sync for Archive
    [debug] Skipping mailbox sync for Archive.2020
    [debug] partial sync 1393:Drafts - get all known UIDs took 0s
    [debug] partial sync 1393:Drafts - get new messages via Horde took 0s
    [debug] partial sync 1393:Drafts - persist new messages took 0s
    [debug] partial sync 1393:Drafts - get changed messages via Horde took 0s
    [debug] partial sync 1393:Drafts - persist changed messages took 0s
    [debug] partial sync 1393:Drafts - get vanished messages via Horde took 0s
    [debug] partial sync 1393:Drafts - persist new messages took 0s
    [debug] partial sync 1393:Drafts took 0s
    [debug] partial sync 1393:INBOX - get all known UIDs took 0s
    [debug] partial sync 1393:INBOX - get new messages via Horde took 0s
    [debug] partial sync 1393:INBOX - classified a chunk of new messages took 1s
    [debug] partial sync 1393:INBOX - persist new messages took 0s
    [debug] partial sync 1393:INBOX - get changed messages via Horde took 1s
    [debug] partial sync 1393:INBOX - persist changed messages took 0s
    [debug] partial sync 1393:INBOX - get vanished messages via Horde took 0s
    [debug] partial sync 1393:INBOX - persist new messages took 0s
    [debug] partial sync 1393:INBOX took 2s
    [debug] Skipping mailbox sync for Sent
    [debug] Skipping mailbox sync for Sentry
    [debug] Skipping mailbox sync for Trash
    [debug] Account 1393 has 19417 messages for threading
    [debug] Threading 19417 messages - build ID table took 1s
    [debug] Threading 19417 messages - build root container took 0s
    [debug] Threading 19417 messages - free ID table took 0s
    [debug] Threading 19417 messages - prune containers took 0s
    [debug] Threading 19417 messages - group by subject took 0s
    [debug] Threading 19417 messages took 1s
    [debug] Account 1393 has 9839 threads
    [debug] Account 1393 has 0 messages with a new thread IDs
    62MB of memory used