Mail app sending email but not moving it to sent folder and reporting mail server error

Nextcloud version (eg, 29.0.5): 29.0.7snap
Operating system and version (eg, Ubuntu 24.04): Ubuntu 22.04
Apache or nginx version (eg, Apache 2.4.25): nginx, I think
PHP version (eg, 8.3): 8.1.2

The issue you are facing:

I am having trouble sending emails using Nextcloud’s mail app when the email has an attachment. Nextcloud mail tells me that it could not send the message with a Server Error. But the message actually sends. I know this because if I send an email with attachment to myself, it arrives in my inbox despite Nextcloud mail app telling me it did not send. It appears the email just doesn’t get placed in the sent folder because of some miscommunication between the SMTP server and Nextcloud. I have the mail app properly configured to place messages in the Sent folder. If the email does not have an attachment, Nextcloud mail sends without issue. I am using the iCloud SMTP server. I do not have this issue using Thunderbird or other email clients.

I have set the config.php file using the recommendations in this community (as per below) but they have not resolved the issue:
‘mail_smtpstreamoptions’ =>
array (
‘ssl’ =>
array (
‘allow_self_signed’ => true,
‘verify_peer’ => false,
‘verify_peer_name’ => false,
),
),

Is this the first time you’ve seen this error? (Y/N):

Steps to replicate it:

  1. Configure Nextcloud mail for an iCloud account
  2. Send email with an attachment

The output of your Nextcloud log in Admin > Logging:

Nothing

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

Nothing

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

Nothing

Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

Nothing

Still having issues with sending mail. I configured the Mail app to use the gmail smtp server and I can sometimes successfully send an email with an attachment, but not every time. So far, my success rate is one out of four emails send and move to the sent folder.

Success is still defined as the email sending and moving to the sent folder. All emails send, but 3 out of 4 do not move to the sent folder and error out as mail server error.

What’s the actual error message?

What appears in your nextcloud.log?

Have you seen the Troubleshooting section of the Mail app README? It can be found here: mail/doc/admin.md at main · nextcloud/mail · GitHub

Thank you for your reply. My snap just updated to V30 and it appears to resolve the issue. Emails with an attachment are sending without failure. Hooray!

I’m on 30.0.2 and mail 4.0.2

We also facing the issue that occasionally mails do not show up in the sent-folder.

In parallel we had the issue that some mails could not be sent at all, without error msg for the user. After pressing the Send button, the user just returns to the mail editor.
DbalException An exception occurred while executing a query: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column ‘subject’ at row 1

Logfile shows that subject is too long. An error msg with how long the subject is allowed to be, would be helpful in such a case.
I’m not sure, if the issue with not copying mails into sent folder might be a potential side effect of this.

The user most likely copied and pasted the subject into the subject field.
We have updated to 4.0.10, even that we couldn’t identify any release notes which looked related to the problems we are currently having.