nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
27.54k stars 4.08k forks source link

Increase visibility of e-mail delivery failures #41343

Open SnejPro opened 1 year ago

SnejPro commented 1 year ago

⚠️ This issue respects the following points: ⚠️

Bug description

When there is a configuration error or the mail server is unable to accept mails from nextcloud (e.g. due to fail2ban) there is no indication that nextcloud is not able to send emails in the nextcloud logging or in the warnings on admin page.

Steps to reproduce

  1. Block the server's ip adress on which nextcloud is installed on your mail server
  2. Try to send a mail through nextcloud (e.g. when sharing something to an email adress.
  3. No email is sent, but there is no error to the user, in the logs or in the warnings on admin page.

Expected behavior

Installation method

Community Manual installation with Archive

Nextcloud Server version

27

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.1

Web server

Nginx

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

None

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

Configuration report

#./nextcloud_occ.sh config:list system
{
    "system": {
        "allow_local_remote_servers": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "***REMOVED SENSITIVE VALUE***",
            "***REMOVED SENSITIVE VALUE***",
            "***REMOVED SENSITIVE VALUE***",
            "***REMOVED SENSITIVE VALUE***"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "27.1.3.2",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "default_phone_region": "DE",
        "enabledPreviewProviders": [
            "OC\\Preview\\PNG",
            "OC\\Preview\\JPEG",
            "OC\\Preview\\GIF",
            "OC\\Preview\\HEIC",
            "OC\\Preview\\SVG",
            "OC\\Preview\\BMP",
            "OC\\Preview\\XBitmap",
            "OC\\Preview\\MP3",
            "OC\\Preview\\TXT",
            "OC\\Preview\\MarkDown"
        ],
        "installed": true,
        "memcache.local": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "filelocking.debug": true,
        "log_type": "file",
        "logtimezone": "Europe\/Berlin",
        "logfile": "***REMOVED SENSITIVE VALUE***\/nextcloud.log",
        "loglevel": 2,
        "mail_smtpmode": "smtp",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpauth": 1,
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "trashbin_retention_obligation": "30, 30",
        "maintenance": false,
        "mysql.utf8mb4": true,
        "theme": "",
        "has_rebuilt_cache": true,
        "mail_sendmailmode": "smtp",
        "encryption.key_storage_migrated": false,
        "data-fingerprint": "e86a39fb84481ffab93dcfa51062cd95",
        "encryption.legacy_format_support": false,
        "app_install_overwrite": [
            "cookbook"
        ]
    }
}

List of activated Apps

Enabled:
  - activity: 2.19.0
  - calendar: 4.5.3
  - circles: 27.0.1
  - cloud_federation_api: 1.10.0
  - collectives: 2.8.2
  - comments: 1.17.0
  - contacts: 5.4.2
  - contactsinteraction: 1.8.0
  - cookbook: 0.10.2
  - dav: 1.27.0
  - deck: 1.11.0
  - encryption: 2.15.0
  - federatedfilesharing: 1.17.0
  - federation: 1.17.0
  - files: 1.22.0
  - files_external: 1.19.0
  - files_pdfviewer: 2.8.0
  - files_reminders: 1.0.0
  - files_rightclick: 1.6.0
  - files_sharing: 1.19.0
  - files_trashbin: 1.17.0
  - files_versions: 1.20.0
  - forms: 3.3.1
  - gpxpod: 5.0.13
  - logreader: 2.12.0
  - lookup_server_connector: 1.15.0
  - mail: 3.4.4
  - maps: 1.1.1
  - nextcloud_announcements: 1.16.0
  - notes: 4.8.1
  - notifications: 2.15.0
  - oauth2: 1.15.1
  - password_policy: 1.17.0
  - photos: 2.3.0
  - privacy: 1.11.0
  - provisioning_api: 1.17.0
  - recommendations: 1.6.0
  - related_resources: 1.2.0
  - richdocuments: 8.2.2
  - serverinfo: 1.17.0
  - settings: 1.9.0
  - sharebymail: 1.17.0
  - support: 1.10.0
  - survey_client: 1.15.0
  - systemtags: 1.17.0
  - tasks: 0.15.0
  - text: 3.8.0
  - theming: 2.2.0
  - twofactor_backupcodes: 1.16.0
  - twofactor_totp: 9.0.0
  - updatenotification: 1.17.0
  - user_status: 1.7.0
  - viewer: 2.1.0
  - workflowengine: 2.9.0
Disabled:
  - admin_audit: 1.17.0
  - bruteforcesettings: 2.7.0 (installed 2.0.1)
  - dashboard: 7.7.0 (installed 7.5.0)
  - firstrunwizard: 2.16.0 (installed 2.14.0)
  - suspicious_login: 5.0.0
  - user_ldap: 1.17.0
  - weather_status: 1.7.0 (installed 1.5.0)

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

No response

Additional info

No response

davispuh commented 4 months ago

This is very annoying. It took me a while with changing PHP code to figure out why emails weren't sending. I hadn't setup "Sent" folder in Dovecot and Nextcloud Mail didn't like that but was failing quite silently. There were no error logs anywhere and in UI message wasn't helpful.

This is how it looks like:

attels

joshtrichards commented 1 month ago

We do log at the debug (0) log level:

https://github.com/nextcloud/server/blob/07f822c916565c9e6110840d00c4dd36dd22d2aa/lib/private/Mail/Mailer.php#L204-L211

Don't like the idea of logging subjects/etc in the system log by default, but maybe we should consider logging something at warn (2) or at least error level here.

joshtrichards commented 1 month ago

@davispuh Your situation is unrelated. It's for the Mail app, not Nextcloud Server so mail handling is separate. Check https://github.com/nextcloud/mail/ for reports and/or report your suggestion there. Also possibly of interest: https://github.com/nextcloud/mail/blob/main/doc/admin.md#troubleshooting