No invitation is sent out for new appointments from LDAP Users

Since the last update, Nextcloud does not seem to send emails
invitations anymore.

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 31.0.2
  • Operating system and version (e.g., Ubuntu 24.04):
    • Debian 12.10
  • Web server and version (e.g, Apache 2.4.25):
    • Apache 2.4.62
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • Apache 2.4.64
  • PHP version (e.g, 8.3):
    • 8.2
  • Is this the first time you’ve seen this error? (Yes / No):
    • yes
  • When did this problem seem to first start?
    • i think is was after the upgarde to the last version
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • manual
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • no

Summary of the issue you are facing:

Nextcloud version does not send invitation for new appointments.

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

  1. Create a new appointment in the calendar
  2. invite participants
  3. save
  4. The e-mail with the invitation is not sent. The dialog show
    “Invitation will be sent” forever

Log entries

ServiceException Sync failed for 1:Sent: An exception occurred while executing a query: SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column ‘sent_at’ at row 1
Cron mail sync failed for account 1

Nextcloud

{"reqId":"FnuLcmfXxmP0oYocufSN","level":3,"time":"2025-04-07T19:21:45+00:00","remoteAddr":"","user":false,"app":"mail","method":"","url":"--","message":"Cron mail sync failed for account 1","userAgent":"--","version":"31.0.2.1","exception":{"Exception":"OCA\\Mail\\Exception\\ServiceException","Message":"Sync failed for 1:Sent: An exception occurred while executing a query: SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'sent_at' at row 1","Code":0,"Trace":[{"file":"/var/www/html/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","line":133,"function":"sync","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/apps/mail/lib/BackgroundJob/SyncJob.php","line":93,"function":"syncAccount","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/Job.php","line":61,"function":"run","class":"OCA\\Mail\\BackgroundJob\\SyncJob","type":"->"},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":88,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":75,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/var/www/html/nextcloud/cron.php","line":170,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/var/www/html/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","Line":282,"Previous":{"Exception":"OC\\DB\\Exceptions\\DbalException","Message":"An exception occurred while executing a query: SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'sent_at' at row 1","Code":1264,"Trace":[{"file":"/var/www/html/nextcloud/lib/private/DB/ConnectionAdapter.php","line":69,"function":"wrap","class":"OC\\DB\\Exceptions\\DbalException","type":"::"},{"file":"/var/www/html/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":306,"function":"executeStatement","class":"OC\\DB\\ConnectionAdapter","type":"->"},{"file":"/var/www/html/nextcloud/apps/mail/lib/Db/MessageMapper.php","line":315,"function":"executeStatement","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/html/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","line":349,"function":"insertBulk","class":"OCA\\Mail\\Db\\MessageMapper","type":"->"},{"file":"/var/www/html/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","line":258,"function":"runInitialSync","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->"},{"file":"/var/www/html/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","line":133,"function":"sync","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/apps/mail/lib/BackgroundJob/SyncJob.php","line":93,"function":"syncAccount","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/Job.php","line":61,"function":"run","class":"OCA\\Mail\\BackgroundJob\\SyncJob","type":"->"},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":88,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":75,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/var/www/html/nextcloud/cron.php","line":170,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/var/www/html/nextcloud/lib/private/DB/Exceptions/DbalException.php","Line":56,"Previous":{"Exception":"Doctrine\\DBAL\\Exception\\DriverException","Message":"An exception occurred while executing a query: SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'sent_at' at row 1","Code":1264,"Trace":[{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1976,"function":"convert","class":"Doctrine\\DBAL\\Driver\\API\\MySQL\\ExceptionConverter","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1918,"function":"handleDriverException","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1218,"function":"convertExceptionDuringQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php","line":292,"function":"executeStatement","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/DB/Connection.php","line":466,"function":"executeStatement","class":"Doctrine\\DBAL\\Connections\\PrimaryReadReplicaConnection","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/DB/ConnectionAdapter.php","line":67,"function":"executeStatement","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":306,"function":"executeStatement","class":"OC\\DB\\ConnectionAdapter","type":"->"},{"file":"/var/www/html/nextcloud/apps/mail/lib/Db/MessageMapper.php","line":315,"function":"executeStatement","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/html/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","line":349,"function":"insertBulk","class":"OCA\\Mail\\Db\\MessageMapper","type":"->"},{"file":"/var/www/html/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","line":258,"function":"runInitialSync","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->"},{"file":"/var/www/html/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","line":133,"function":"sync","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/apps/mail/lib/BackgroundJob/SyncJob.php","line":93,"function":"syncAccount","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/Job.php","line":61,"function":"run","class":"OCA\\Mail\\BackgroundJob\\SyncJob","type":"->"},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":88,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":75,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/var/www/html/nextcloud/cron.php","line":170,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php","Line":118,"Previous":{"Exception":"Doctrine\\DBAL\\Driver\\PDO\\Exception","Message":"SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'sent_at' at row 1","Code":1264,"Trace":[{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php","line":132,"function":"new","class":"Doctrine\\DBAL\\Driver\\PDO\\Exception","type":"::"},{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1212,"function":"execute","class":"Doctrine\\DBAL\\Driver\\PDO\\Statement","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php","line":292,"function":"executeStatement","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/DB/Connection.php","line":466,"function":"executeStatement","class":"Doctrine\\DBAL\\Connections\\PrimaryReadReplicaConnection","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/DB/ConnectionAdapter.php","line":67,"function":"executeStatement","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":306,"function":"executeStatement","class":"OC\\DB\\ConnectionAdapter","type":"->"},{"file":"/var/www/html/nextcloud/apps/mail/lib/Db/MessageMapper.php","line":315,"function":"executeStatement","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/html/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","line":349,"function":"insertBulk","class":"OCA\\Mail\\Db\\MessageMapper","type":"->"},{"file":"/var/www/html/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","line":258,"function":"runInitialSync","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->"},{"file":"/var/www/html/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","line":133,"function":"sync","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/apps/mail/lib/BackgroundJob/SyncJob.php","line":93,"function":"syncAccount","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/Job.php","line":61,"function":"run","class":"OCA\\Mail\\BackgroundJob\\SyncJob","type":"->"},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":88,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":75,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/var/www/html/nextcloud/cron.php","line":170,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Exception.php","Line":24,"Previous":{"Exception":"PDOException","Message":"SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'sent_at' at row 1","Code":"22003","Trace":[{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php","line":130,"function":"execute","class":"PDOStatement","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Connection.php","line":1212,"function":"execute","class":"Doctrine\\DBAL\\Driver\\PDO\\Statement","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Connections/PrimaryReadReplicaConnection.php","line":292,"function":"executeStatement","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/DB/Connection.php","line":466,"function":"executeStatement","class":"Doctrine\\DBAL\\Connections\\PrimaryReadReplicaConnection","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/DB/ConnectionAdapter.php","line":67,"function":"executeStatement","class":"OC\\DB\\Connection","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php","line":306,"function":"executeStatement","class":"OC\\DB\\ConnectionAdapter","type":"->"},{"file":"/var/www/html/nextcloud/apps/mail/lib/Db/MessageMapper.php","line":315,"function":"executeStatement","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"/var/www/html/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","line":349,"function":"insertBulk","class":"OCA\\Mail\\Db\\MessageMapper","type":"->"},{"file":"/var/www/html/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","line":258,"function":"runInitialSync","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->"},{"file":"/var/www/html/nextcloud/apps/mail/lib/Service/Sync/ImapToDbSynchronizer.php","line":133,"function":"sync","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/apps/mail/lib/BackgroundJob/SyncJob.php","line":93,"function":"syncAccount","class":"OCA\\Mail\\Service\\Sync\\ImapToDbSynchronizer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/Job.php","line":61,"function":"run","class":"OCA\\Mail\\BackgroundJob\\SyncJob","type":"->"},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":88,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/var/www/html/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":75,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/var/www/html/nextcloud/cron.php","line":170,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php","Line":130}}}},"message":"Cron mail sync failed for account {accountId}","exception":[],"CustomMessage":"Cron mail sync failed for account 1"},"id":"67f432bea6454"}

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!):

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "192.168.115.32",
            "jansen.priv",
            "family-jansen.de",
            "nextcloud2.jansen.priv",
            "nextcloud.jansen.priv",
            "cloud.family-jansen.de"
        ],
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "http:\/\/192.168.115.32\/nextcloud",
        "overwritehost": "cloud.family-jansen.de",
        "overwriteprotocol": "https",
        "dbtype": "mysql",
        "version": "31.0.2.1",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "installed": true,
        "maintenance": false,
        "theme": "",
        "default_phone_region": "DE",
        "loglevel": 0,
        "ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory",
        "mail_smtpmode": "smtp",
        "mail_sendmailmode": "smtp",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "maintenance_window_start": 1,
        "app_install_overwrite": [
            "auto_mail_accounts"
        ],
        "mail_smtpauth": 1,
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "updater.release.channel": "stable",
        "data-fingerprint": "4b8e7296c2930039b75b5fef39f9d7e8"
    }
}

Apps

Enabled:
  - activity: 4.0.0
  - app_api: 5.0.2
  - bruteforcesettings: 4.0.0
  - calendar: 5.2.1
  - calendar_resource_management: 0.9.0
  - circles: 31.0.0
  - cloud_federation_api: 1.14.0
  - comments: 1.21.0
  - contacts: 7.0.4
  - contactsinteraction: 1.12.0
  - dashboard: 7.11.0
  - dav: 1.33.0
  - deck: 1.15.0
  - external: 6.0.2
  - federatedfilesharing: 1.21.0
  - federation: 1.21.0
  - files: 2.3.1
  - files_downloadlimit: 4.0.0
  - files_pdfviewer: 4.0.0
  - files_reminders: 1.4.0
  - files_sharing: 1.23.1
  - files_trashbin: 1.21.0
  - files_versions: 1.24.0
  - fileslibreofficeedit: 2.0.1
  - firstrunwizard: 4.0.0
  - forms: 5.1.0
  - groupfolders: 19.0.4
  - logreader: 4.0.0
  - lookup_server_connector: 1.19.0
  - mail: 4.3.6
  - nextcloud_announcements: 3.0.0
  - notes: 4.11.0
  - notifications: 4.0.0
  - oauth2: 1.19.1
  - password_policy: 3.0.0
  - polls: 7.4.2
  - privacy: 3.0.0
  - profile: 1.0.0
  - provisioning_api: 1.21.0
  - recommendations: 4.0.0
  - related_resources: 2.0.0
  - richdocuments: 8.6.4
  - richdocumentscode: 24.4.1302
  - serverinfo: 3.0.0
  - settings: 1.14.0
  - sharebymail: 1.21.0
  - spreed: 21.0.1
  - support: 3.0.0
  - survey_client: 3.0.0
  - systemtags: 1.21.1
  - tasks: 0.16.1
  - text: 5.0.0
  - theming: 2.6.1
  - twofactor_backupcodes: 1.20.0
  - updatenotification: 1.21.0
  - user_ldap: 1.22.0
  - user_status: 1.11.0
  - viewer: 4.0.0
  - weather_status: 1.11.0
  - webhook_listeners: 1.2.0
  - workflowengine: 2.13.0
Disabled:
  - admin_audit: 1.21.0
  - encryption: 2.19.0
  - files_external: 1.23.0
  - keeweb: 0.6.21 (installed 0.6.21)
  - ldap_write_support: 1.13.0 (installed 1.13.0)
  - maps: 1.5.0 (installed 1.5.0)
  - photos: 4.0.0-dev.1 (installed 2.4.0)
  - suspicious_login: 9.0.1
  - twofactor_nextcloud_notification: 5.0.0
  - twofactor_totp: 13.0.0-dev.0

I have taken a closer look at the problem:

The invitations are only not sent if the user who creates the appointment is authenticated via LDAP.
If the user is created directly in Nextcloud, the invitation is sent.

Whether the invitee is known to Nextcloud, comes from LDAP or is completely unknown is irrelevant.

If the invitation is not sent, no attempt is made to connect to the mail server.

The log entry from the first amount does not seem to be related to the error.