Failed to send share by email

Nextcloud version: 16.0.4
Operating system and version: Ubuntu 18.04 LTS
Apache version: 2.4.29
PHP version: 7.2.19

The issue you are facing:
When I try to share a file to an external Email address I get the error “Failed to send share by mail”

The SMTP configuration is alright. Testmail works and password forget function sends a mail to the user.
Sharing to internal users works.

User Auth is LDAP.

Steps to replicate it:

  1. Create file
  2. Klick on share button
  3. Enter external Email address

The output of your Nextcloud log in Admin > Logging:

https://pastebin.com/YZQ7BbdF

The output of your config.php file in /path/to/nextcloud:

https://pastebin.com/me1MDZjQ

The output of your Apache system log:

https://pastebin.com/ia4EFciz

quick question: have you enabled app social sharing via email?

No and it’s not downloaded either.

the official name of it is: share by mail and Social sharing via email. both are official apps which should be provided automatically.

I downloaded and activated social sharing via email (share by mail was already active) but I still get the same error. Do you have another idea what could be causing the error?

I am having the same issue. Share by email worked until about 2 weeks ago. Now my users have to copy the link and share via Outlook

We are also seeing this issue. Same versions and installation options.
Actually, some more looking around gave this thread which fixed my issues for now:

Still waiting for a real fix though.

Is the Nextcloud team aware of this, and is there a bug report? This is affecting my production instance.

The problem I had found is after updating NextCloud, 16.0.* it looks like the config may have not converted correctly

in the log under settings was showing .

sharebymail	Swift_RfcComplianceException: Address in mailbox given [Filebox@*******.com@localhost.localdomain] does not comply with RFC 2822, 3.6.2.

So to resolve this problem I changed:

Under basic setting I did find that the from email address had been filled in with the completed name@domain.com and the domain field had been filled in with the domain only.

After correcting this it was fine.

Not sure if this is or was your problem but Seeing I am not seeing a real answer to this problem. I am posting what I had to do to fix this same problem you had described.