nextcloud / mail

💌 Mail app for Nextcloud
https://apps.nextcloud.com/apps/mail
GNU Affero General Public License v3.0
842 stars 260 forks source link

Emails fail to send with "Could not send message" #8629

Open amyipdev opened 1 year ago

amyipdev commented 1 year ago

Steps to reproduce

  1. Configure a user to use SMTP, no encryption (starttls and ssl/tls directly are unsupported on my current postfix config)
  2. Attempt to send an email to any source (can send to yourself as a test)
  3. Observe failure

Expected behavior

An email should be properly sent.

Actual behavior

No email is sent, and an error saying "Could not send message" appears.

Mail app version

3.2.4

Mailserver or service

Postfix

Operating system

Debian 12/bookworm

PHP engine version

PHP 8.2

Web server

Apache (supported)

Database

MariaDB

Additional info

Sending over (unencrypted) SMTP works completely fine on Thunderbird, so no reason it should fail on NC. I'm trying to get unencrypted set up first (passwords only traverse my local network currently, once I actually use this externally it'll need to be encrypted) and then get encrypted set up later (with proper SSL and all).

amyipdev commented 1 year ago

magically, this started working again. i'll keep posted here if anything changes

amyipdev commented 1 year ago

I'm reopening this since my testing with other accounts is making this happen again, and I'm not sure why. I'll keep experimenting

amyipdev commented 1 year ago

i have noticed two more things so far:

  1. despite me telling NC Mail not to use starttls, based on my postfix double-bounce logs, it's still trying to anyways a lot of the time.
  2. i have starttls working now (tested via thunderbird), NC still doesn't work properly (some accounts will work, some of the time, others just wont work at all) and if i try to set it to use starttls it just doesn't even let me save the connection
amyipdev commented 1 year ago

update: decided to wireshark my nextcloud instance. found out that, while there's normal smtp traffic whenever an email sends correctly, on the ones where it fails, it appears NC didn't even attempt to send anything. there's not a single SMTP packet. and, just to double-check, i looked if there was any traffic on 25/tcp on a fail, and nope, not even a SYN...

amyipdev commented 1 year ago

another update: upped 465 and 587. can use no TLS for one of my accounts succesfully, other one still doesn't work. can run no TLS over 587. using implicit TLS and STARTTLS both fail for all accounts to even save the profile still

amyipdev commented 1 year ago

so there appears to be IMAP issues here as well. i have proper IMAP with SSL/TLS and IMAP with STARTTLS set up. works fine in thunderbird. but yet again can't save an account with it on NC Mail...

amyipdev commented 1 year ago

i believe this has something to do with the smtp module NC uses. i went to the server-side settings (for sending, say, notifications) and couldn't send anything. however, my tests worked fine when changing to the sendmail option... granted, doesn't fix user emails, but still might help with debugging

nagmat84 commented 9 months ago

Maybe this bug is has the same root cause as I describe in https://github.com/nextcloud/mail/issues/9230#issuecomment-1885614975.

Have you checked whether the default folders for "Sent mails" and "Trash" is correctly configured and point to existing folders?

In https://github.com/nextcloud/mail/issues/8629#issuecomment-1641013328 you write that Wireshark shows that Nextcloud does not even do anything. I encountered the same problem and after hours of trial-and-error I found out that the Mail App does not attempt to send an email (or delete an email) if the respective folder for sent/deleted mails is not properly configured.

amyipdev commented 8 months ago

@nagmat84 the issue appears to be fixed, at least for my case, in NC Hub 28. Can you confirm whether the same is occurring for you?

opsec commented 2 months ago

Test on FreeBSD 14.1p3, php 8.3, nextcloud 29.0.4, nextcloud-mail 3.7.7: Same problem.

opsec commented 2 months ago

Tested with recommendations from https://github.com/nextcloud/mail/issues/9230#issuecomment-1885614975, now I can at least respond via the Mail app.

alnitac commented 1 week ago

I opened a previous issue https://github.com/nextcloud/mail/issues/10217 which i closed because i could send with a "professionnel" mailbox. I tried again with the first mailbox and noticed :