Cannot send calendar invitation throught user's email account

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • Nextcloud Hub 9 (30.0.5)
  • Operating system and version (e.g., Ubuntu 24.04):
    • Debian 12
  • Web server and version (e.g, Apache 2.4.25):
    • Apache/2.4.62 (Debian)
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • None
  • PHP version (e.g, 8.3):
    • 8.2.26
  • Is this the first time you’ve seen this error? (Yes / No):
    • Yes
  • When did this problem seem to first start?
    • Today, first time I tried this functionality
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • Bare metal
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • no

Summary of the issue you are facing:

I cannot send Calendar invites through the user email address

Steps to replicate it (hint: details matter!):

  1. Install the Mail app (version 4.1.2)
  2. Configure the mail app using gmail account with two factor authentication enabled and generating an app password
  3. Test the email app: I can receive and send emails
  4. Install and configure Calendar (version 5.0.9)
  5. Set the user email address in the profile as the address configured in the Mail app
  6. Administration settings >> Basic settings >> Mail providers section >> Click the radio button “User’s email account”
  7. Create a calendar event, add an invitee and send it
  8. The invitation is not sent (see logs)

Log entries

Nextcloud

Please provide the log entries from your Nextcloud log that are generated during the time of problem (via the Copy raw option from Administration settings->Logging screen or from your nextcloud.log located in your data directory). Feel free to use a pastebin/gist service if necessary.

{"reqId":"toIWSRvhUAUnfDkqqRRN","level":3,"time":"2025-02-12T17:03:42+01:00","remoteAddr":"REDACTED","user":"giovi","app":"dav","method":"PUT","url":"/remote.php/dav/calendars/giovi/cloud-personal/6B03274B-3C4A-4ADC-9A1B-E469CD70403A.ics","message":"Unable to deliver message to REDACTED@REDACTED.com","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:131.0) Gecko/20100101 Firefox/131.0","version":"30.0.5.1","data":{"app":"dav"}}

Web Browser

If the problem is related to the Web interface, open your browser inspector Console and Network tabs while refreshing (reloading) and reproducing the problem. Provide any relevant output/errors here that appear.

There's too much information to redact. Since it seems to be a backend issue, I didn't paste anything. If this is crucial information, please let me know.

Web server / Reverse Proxy

The output of your Apache/nginx/system log in /var/log/____:

No reverse proxy

Configuration

Nextcloud

The output of occ config:list system or similar is best, but, if not possible, the contents of your config.php file from /path/to/nextcloud is fine (make sure to remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'redacted',
  'passwordsalt' => 'redacted',
  'secret' => 'redacted',
  'trusted_domains' => 
  array (
    0 => 'redacted.com',
  ),
  'datadirectory' => '/home/cloud/data',
  'logtimezone' => 'Europe/Rome',
  'dbtype' => 'mysql',
  'version' => '30.0.5.1',
  'overwrite.cli.url' => 'https://redacted.com',
  'dbname' => 'cloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'redacted',
  'dbpassword' => 'redacted',
  'installed' => true,
  'twofactor_enforced' => 'true',
  'twofactor_enforced_groups' => 
  array (
  ),
  'twofactor_enforced_excluded_groups' => 
  array (
  ),
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'maintenance_window_start' => 4,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'default_phone_region' => 'IT',
  'timezone' => 'Europe/Rome',
  'forbidden_filename_basenames' => 
  array (
    0 => 'con',
    1 => 'prn',
    2 => 'aux',
    3 => 'nul',
    4 => 'com0',
    5 => 'com1',
    6 => 'com2',
    7 => 'com3',
    8 => 'com4',
    9 => 'com5',
    10 => 'com6',
    11 => 'com7',
    12 => 'com8',
    13 => 'com9',
    14 => 'com¹',
    15 => 'com²',
    16 => 'com³',
    17 => 'lpt0',
    18 => 'lpt1',
    19 => 'lpt2',
    20 => 'lpt3',
    21 => 'lpt4',
    22 => 'lpt5',
    23 => 'lpt6',
    24 => 'lpt7',
    25 => 'lpt8',
    26 => 'lpt9',
    27 => 'lpt¹',
    28 => 'lpt²',
    29 => 'lpt³',
  ),
  'forbidden_filename_characters' => 
  array (
    0 => '<',
    1 => '>',
    2 => ':',
    3 => '"',
    4 => '|',
    5 => '?',
    6 => '*',
    7 => '\\',
    8 => '/',
  ),
  'forbidden_filename_extensions' => 
  array (
    0 => ' ',
    1 => '.',
    2 => '.filepart',
    3 => '.part',
  ),
);

Apps

The output of occ app:list (if possible).

Enabled:
  - activity: 3.0.0
  - app_api: 4.0.5
  - bruteforcesettings: 3.0.0
  - calendar: 5.0.9
  - cloud_federation_api: 1.13.0
  - contacts: 6.1.3
  - contactsinteraction: 1.11.0
  - dav: 1.31.1
  - federatedfilesharing: 1.20.0
  - files: 2.2.0
  - files_downloadlimit: 3.0.0
  - files_sharing: 1.22.0
  - files_trashbin: 1.20.1
  - files_versions: 1.23.0
  - logreader: 3.0.0
  - lookup_server_connector: 1.18.0
  - mail: 4.1.2
  - nextcloud_announcements: 2.0.0
  - notes: 4.11.0
  - notifications: 3.0.0
  - oauth2: 1.18.1
  - photos: 3.0.2
  - privacy: 2.0.0
  - provisioning_api: 1.20.0
  - related_resources: 1.5.0
  - serverinfo: 2.0.0
  - settings: 1.13.0
  - sharebymail: 1.20.0
  - theming: 2.5.0
  - twofactor_backupcodes: 1.19.0
  - twofactor_totp: 12.0.0-dev
  - updatenotification: 1.20.0
  - viewer: 3.0.0
  - webhook_listeners: 1.1.0-dev
  - workflowengine: 2.12.0
Disabled:
  - admin_audit: 1.20.0
  - circles: 30.0.0 (installed 28.0.0)
  - comments: 1.20.1 (installed 1.18.0)
  - dashboard: 7.10.0 (installed 7.8.0)
  - encryption: 2.18.0
  - federation: 1.20.0 (installed 1.18.0)
  - files_external: 1.22.0
  - files_pdfviewer: 3.0.0 (installed 3.0.0)
  - files_reminders: 1.3.0 (installed 1.1.0)
  - firstrunwizard: 3.0.0 (installed 2.17.0)
  - mail_roundcube: 1.1.1 (installed 1.1.1)
  - password_policy: 2.0.0 (installed 1.18.0)
  - recommendations: 3.0.0 (installed 2.0.0)
  - support: 2.0.0 (installed 1.11.1)
  - survey_client: 2.0.0 (installed 1.16.0)
  - suspicious_login: 8.0.0
  - systemtags: 1.20.0 (installed 1.18.0)
  - text: 4.1.0 (installed 3.9.1)
  - twofactor_nextcloud_notification: 4.0.0
  - user_ldap: 1.21.0
  - user_status: 1.10.0 (installed 1.8.1)
  - weather_status: 1.10.0 (installed 1.8.0)

I’m experiencing the same issue. I have tried both with an app password and by using the OAuth login. Both cases lead to the same issue with the same entry in the logs.

I was reading through the code for this feature server/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php at 6b2c5b8aa67a5678d15a80eb9b3b124a20d53ffa · nextcloud/server · GitHub and it seems like this error message only happens when Nextcloud uses the system email configuration to send calendar related emails.

From my reading of the code, there’s a few reasons why this could happen:

  • Nextcloud is configured to send calendar emails through the system email account
  • It can’t find the current user
  • It can’t find an email account for the current user that matches the sender (Not 100% sure what that is, I think that it comes from the user’s primary email address in their profile)
  • It finds an email account which doesn’t support sending emails (this shouldn’t happen)

I’ve spent a few hours rummaging through the code and validating that all the conditions should be met and yet it doesn’t quite work. I’m not sure what’s going on. I’m not well equipped to debug this so my analysis is only theoretical.