Unable share with Exchange mail contacts

Support intro

Hello!
I have not problem to share files with external users via email or with internal MS AD users - allowed security groups members.
But I unable send share email to external email if this email belong to our internal MS Exchange mail contact.

Nextcloud version _: 16.0.1.1
Operating system and version : CentOS 7
Apache or nginx version _: nginx 1.15.12
PHP version _: PHP 7.3.4
PHP-FPM: 7.3.4
MariaDB: 10.4.4

Steps to replicate it:

  1. Configure AD connection
  2. Restrict using of NC by AD security group membership
  3. Configure external mail contact on MS Exchange server
  4. Try share file with exchange mail contact - receive an error

The output of your Nextcloud log in Admin > Logging:

Error	index	Exception: The requested uri(/ocs/v2.php/apps/files_sharing/api/v1/shares) cannot be processed by the script '/apps/files_sharing/api/v1/shares?')

    /usr/share/nginx/html/nextcloud/lib/base.php - line 918:

    OC\AppFramework\Http\Request->getRawPathInfo()

    /usr/share/nginx/html/nextcloud/index.php - line 42:

    OC::handleRequest()

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php $CONFIG = array ( 'instanceid' => '-', 'passwordsalt' => '-', 'secret' => '-', 'trusted_domains' => array ( 0 => '-', ), 'datadirectory' => '/mnt/hdd2/nextcloud/data', 'dbtype' => 'mysql', 'version' => '16.0.1.1', 'overwrite.cli.url' => 'https://---', 'dbname' => 'nextcloud_db', 'dbhost' => 'localhost', 'dbport' => '', 'dbtableprefix' => 'oc_', 'mysql.utf8mb4' => true, 'dbuser' => '---', 'dbpassword' => '---', 'installed' => true, 'loglevel' => 1, 'logfile' => '/mnt/hdd2/nextcloud/data/nextcloud.log', 'logdateformat' => 'F d, Y H:i:s', 'logtimezone' => 'Europe/Moscow', 'log_rotate_size' => 10485760, 'cron_log' => true, 'memcache.local' => '\\OC\\Memcache\\APCu', 'memcache.locking' => '\\OC\\Memcache\\Redis', 'redis' => array ( 'host' => 'localhost', 'port' => 6379, ), 'auth.bruteforce.protection.enabled' => true, 'default_language' => 'ru', 'force_language' => 'ru', 'default_locale' => 'ru_RU', 'force_locale' => 'ru_RU', 'knowledgebaseenabled' => true, 'mail_from_address' => '-', 'mail_smtpmode' => 'smtp', 'mail_sendmailmode' => 'pipe', 'mail_domain' => '-', 'mail_smtphost' => '-', 'mail_smtpport' => '587', 'mail_smtpauth' => 1, 'mail_smtpname' => '-', 'mail_smtppassword' => '-', 'mail_smtpauthtype' => 'LOGIN', 'mail_smtpsecure' => 'tls', 'updatechecker' => true, 'updater.server.url' => 'https://updates.nextcloud.com/updater_server/', 'updater.release.channel' => 'stable', 'trashbin_retention_obligation' => 'auto, 7', 'tempdirectory' => '/mnt/hdd2/nextcloud/tmp', 'ldapIgnoreNamingRules' => false, 'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory', 'maintenance' => false, 'theme' => '', ); The output of your Apache/nginx/system log in `/var/log/____`: ``` PASTE HERE ```![share_with_exchange_contact-error|690x383](upload://6n7hF4tTgqrQFRlJVcDE23jxb24.jpeg) ![share_with_external-success|512x256](upload://m9BL9urB3BGHaqMQ5YzNCtjZ9E2.jpeg)