Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: SMTP Debug mode seem not to work in 26 // "mail_smtpdebug" option ignored #11082

Closed
6 of 9 tasks
flueders opened this issue Mar 30, 2023 · 7 comments · Fixed by #11080
Closed
6 of 9 tasks

[Bug]: SMTP Debug mode seem not to work in 26 // "mail_smtpdebug" option ignored #11082

flueders opened this issue Mar 30, 2023 · 7 comments · Fixed by #11080

Comments

@flueders
Copy link

flueders commented Mar 30, 2023

⚠️ This issue respects the following points: ⚠️

  • This is a bug, not a question or a configuration/webserver/proxy issue.
  • This issue is not already reported on Github (I've searched it).
  • Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • Nextcloud Server is running on 64bit capable CPU, PHP and OS.
  • I agree to follow Nextcloud's Code of Conduct.

Bug description

I try to set up my SMTP email server, but currently running into some issues. The test mail on the configuration page cannot be sent. I tried lots of different configurations for the mail settings, but the error message always re-appears.

However, when I try to investigate the exact problem, it would be great if I had some further information. I set the "mail_smtpdebug" => true,
option in order to retain more detailed information.

Documentation says that debugging messages should be displayed on the Shame configuration page, where one can trigger the test mail. Also, there is nothing related in the PHP logs (except for a PHP error in the temnplate file /apps/settings/templates/settings/admin/additional-mail.php "Undefined array key 'mail_smtpathtype' -- but I don't think this is related to the main problem though)

Steps to reproduce

  1. Try to set SMTP setting via config page or config.php (according to documentation)
  2. Enable mail_smtpdebug
  3. Send a test mail

Expected behavior

Detailled information is shown - either on screen or in the logs

Installation method

Community Web installer on a VPS or web space

Nextcloud Server version

26

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.1

Web server

Apache (supported)

Database engine version

MariaDB

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

Fresh Nextcloud Server install

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "system": {
        "config_is_read_only": true,
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost",
             ****
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "26.0.0.11",
        "overwrite.cli.url": "http:\/\/localhost",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_smtpsecure": "ssl",
        "mail_sendmailmode": "pipe",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "mail_smtpauth": 1,
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpdebug": true
    }
}

List of activated Apps

- cloud_federation_api: 1.9.0
  - dav: 1.25.0
  - federatedfilesharing: 1.16.0
  - files: 1.21.1
  - files_pdfviewer: 2.7.0
  - files_rightclick: 1.5.0
  - files_sharing: 1.18.0
  - files_trashbin: 1.16.0
  - files_versions: 1.19.1
  - firstrunwizard: 2.15.0
  - integration_onedrive: 1.1.4
  - logreader: 2.11.0
  - lookup_server_connector: 1.14.0
  - oauth2: 1.14.0
  - password_policy: 1.16.0
  - photos: 2.2.0
  - privacy: 1.10.0
  - provisioning_api: 1.16.0
  - serverinfo: 1.16.0
  - settings: 1.8.0
  - text: 3.7.2
  - theming: 2.1.1
  - twofactor_backupcodes: 1.15.0
  - updatenotification: 1.16.0
  - user_status: 1.6.0
  - viewer: 1.10.0
  - workflowengine: 2.8.0
Disabled:
  - activity: 2.18.0 (installed 2.18.0)
  - admin_audit: 1.16.0
  - bruteforcesettings: 2.6.0
  - circles: 26.0.0 (installed 26.0.0)
  - comments: 1.16.0 (installed 1.16.0)
  - contactsinteraction: 1.7.0 (installed 1.7.0)
  - dashboard: 7.6.0 (installed 7.6.0)
  - encryption: 2.14.0
  - federation: 1.16.0 (installed 1.16.0)
  - files_external: 1.18.0
  - nextcloud_announcements: 1.15.0 (installed 1.15.0)
  - notifications: 2.14.0 (installed 2.14.0)
  - recommendations: 1.5.0 (installed 1.5.0)
  - related_resources: 1.1.0-alpha1 (installed 1.1.0-alpha1)
  - sharebymail: 1.16.0 (installed 1.16.0)
  - support: 1.9.0 (installed 1.9.0)
  - survey_client: 1.14.0 (installed 1.14.0)
  - suspicious_login: 4.4.0
  - systemtags: 1.16.0 (installed 1.16.0)
  - twofactor_totp: 8.0.0-alpha.0
  - user_ldap: 1.16.0
  - weather_status: 1.6.0 (installed 1.6.0)

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

{"reqId":"9wgouekEnMWoB9U2RlHI","level":3,"time":"2023-03-30T17:44:45+00:00","remoteAddr":"****","user":"admin","app":"PHP","method":"GET","url":"/c/index.php/settings/admin","message":"Undefined array key \"mail_smtpauthtype\" at /var/www/vhosts/*****/httpd>

Additional info

No response

@chriscroome
Copy link

chriscroome commented May 11, 2023

I can't get SMTP email working at all using the latest version of Nextcloud with PHP 8.2:

occ status --output=json | jq
{
  "installed": true,
  "version": "26.0.1.1",
  "versionstring": "26.0.1",
  "edition": "",
  "maintenance": false,
  "needsDbUpgrade": false,
  "productname": "Nextcloud",
  "extendedSupport": false
}

The server accepts unauthenticated email to port 25 on localhost (this has been tested), so I would expect that these settings would work:

{
  "mail_sendmailmode": "smtp",
  "mail_smtpauth": "False",
  "mail_smtpauthtype": "",
  "mail_smtpdebug": true,
  "mail_smtphost": "localhost",
  "mail_smtpmode": "smtp",
  "mail_smtpname": "",
  "mail_smtppassword": "",
  "mail_smtpport": 25,
  "mail_smtpsecure": ""
}

However the "Send email" click results in:

A problem occurred while sending the email. Please revise your settings. (Error: Email could not be sent. Check your mail server log)

And in the Apache log a 400 error for the POST:

XX.XX.XX.XX - - [11/May/2023:10:29:56 +0000] "POST /settings/admin/mailtest HTTP/2.0" 400 868 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0"

Nothing in the PHP log and nothing in the data/nextcloud.log, note that I have mail_smtpdebug set to True, in the Exim log there is a clue:

2023-05-11 10:29:56.315 [764419] no MAIL in SMTP connection from localhost [127.0.0.1]:45698 I=[127.0.0.1]:25 D=0.032s X=TLS1.3:ECDHE_X25519__ECDSA_SECP256R1_SHA256__AES_256_GCM:256 CV=no SNI=localhost C=EHLO,STARTTLS

So it looks like something happens but no mail is sent.

However if I use these settings:

{
  "mail_sendmailmode": "smtp",
  "mail_smtpauth": "False",
  "mail_smtpauthtype": "",
  "mail_smtpdebug": true,
  "mail_smtphost": "localhost",
  "mail_smtpmode": "sendmail",
  "mail_smtpname": "",
  "mail_smtppassword": "",
  "mail_smtpport": 25,
  "mail_smtpsecure": ""
}

The POST returns a 200:

XX.XX.XX.XX - - [11/May/2023:10:40:15 +0000] "POST /settings/admin/mailtest HTTP/2.0" 200 774 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0"

And the email is sent.

I'd like to solve this if possible as I don't really want to switch sites from using SMTP to sendmail as I upgrade them, however for now that appears to be the only option.

I did try installing a few PHP mail packages but that made no difference:

aptitude search php | grep -i mail | grep ^i
i A php-email-validator - A library for validating emails against several RFCs
i  php-mail - Class that provides multiple interfaces for sending emails
i  php-mail-mime - PHP PEAR module for creating MIME messages
i  php-swiftmailer - Swiftmailer, free feature-rich PHP mailer
i  php-symfony-mailer - help sending emails

@wargreen
Copy link

Same issue here, installed manually on our server. All the upgrades since OC (maybe 5 years before) was seamless on the mails side.
"version": "26.0.2.1",
"versionstring": "26.0.2",

@HiptJo
Copy link

HiptJo commented Jul 11, 2023

Same issue here, email broke after updating

@HiptJo
Copy link

HiptJo commented Jul 11, 2023

Yeah, but it did not help at all.
No logs can be found (nextcloud.log contains recent HTTP logs but no details concerning SMTP config test runs - even though the smtp debug flag is enabled in the config).
Furthermore i believe this issue breaks appointments - i can not book any appointment at the time (not verified that it is connected to the mail issue directly but logs show something concerning mail there as well)

@kesselb
Copy link
Contributor

kesselb commented Aug 28, 2023

Thanks for your bug report 👍

The relevant change from 25 to 27 is that we replaced Swift Mailer with Symfony Mailer.

Please check the other issues for troubleshooting tips:

nextcloud/server#37329
nextcloud/server#37694
nextcloud/server#38957
nextcloud/server#39452
nextcloud/server#39538

@joshtrichards
Copy link
Member

In addition to setting mail_smtpdebug to true, the global loglevel needs to be set to 0. Doc update pending in #11080

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants