镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

[Bug]: Email could not be sent #40073

Closed as not planned
Closed as not planned

Description

@ETararenko

⚠️ This issue respects the following points: ⚠️

Bug description

A problem occurred while sending the email. Please revise your settings. (Error: Email could not be sent. Check your mail server log).
image
Share notification mail also could not be sent.
When sharing file, the following message in logging:
image
When i send mail from the server using command
sendemail -f mail_from@.com -t mail_to@.com -u subject -m "message" -s mail_server.com:25
mail comes

Steps to reproduce

When configuring the mail server, when you click send mail, an error occurs.

Expected behavior

Mail must be sent.

Installation method

Community Manual installation with Archive

Nextcloud Server version

27

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": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "*****.****"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "27.0.2.1",
        "overwrite.cli.url": "http:\/\/******.****",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_sendmailmode": "smtp",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "25",
        "mail_smtpdebug": true,
        "ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory",
        "maintenance": false
    }
}

List of activated Apps

Enabled:
  - activity: 2.19.0
  - admin_audit: 1.17.0
  - announcementcenter: 6.6.2
  - calendar: 4.4.4
  - circles: 27.0.1
  - cloud_federation_api: 1.10.0
  - comments: 1.17.0
  - contacts: 5.3.2
  - contactsinteraction: 1.8.0
  - dashboard: 7.7.0
  - dav: 1.27.0
  - drawio: 2.1.2
  - federatedfilesharing: 1.17.0
  - federation: 1.17.0
  - files: 1.22.0
  - files_pdfviewer: 2.8.0
  - files_rightclick: 1.6.0
  - files_sharing: 1.19.0
  - files_trashbin: 1.17.0
  - files_versions: 1.20.0
  - firstrunwizard: 2.16.0
  - impersonate: 1.14.0
  - logreader: 2.12.0
  - lookup_server_connector: 1.15.0
  - mail: 3.3.1
  - nextcloud_announcements: 1.16.0
  - notes: 4.8.1
  - notifications: 2.15.0
  - oauth2: 1.15.1
  - officeonline: 2.0.2
  - 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
  - serverinfo: 1.17.0
  - settings: 1.9.0
  - sharebymail: 1.17.0
  - spreed: 17.0.3
  - support: 1.10.0
  - survey_client: 1.15.0
  - systemtags: 1.17.0
  - text: 3.8.0
  - theming: 2.2.0
  - twofactor_backupcodes: 1.16.0
  - updatenotification: 1.17.0
  - user_ldap: 1.17.0
  - user_status: 1.7.0
  - viewer: 2.1.0
  - weather_status: 1.7.0
  - workflowengine: 2.9.0
Disabled:
  - bruteforcesettings: 2.7.0
  - encryption: 2.15.0
  - files_external: 1.19.0
  - suspicious_login: 5.0.0
  - twofactor_totp: 9.0.0

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

{"reqId":"dXme5veE6SxR08Pe9xx1","level":3,"time":"2023-08-28T08:19:38+00:00","remoteAddr":"**.**.***.***","user":"administrator","app":"no app in context","method":"POST","url":"/ocs/v2.php/apps/files_sharing/api/v1/shares","message":"Share notification mail could not be sent to: ******@****","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36","version":"27.0.2.1","data":[]}

Additional info

No response

Activity

  1. kesselb commented on Aug 28, 2023

    @kesselb
    Contributor

    Did you check the mail server log?

  2. changed the title [-][Bug]: [/-] [+][Bug]: Email could not be sent[/+] on Aug 28, 2023
  3. kesselb commented on Aug 28, 2023

    @kesselb
    Contributor

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

    Please check the other issues for troubleshooting tips:

    #37329
    #37694
    #38957
    #39452
    #39538

  4. ETararenko commented on Aug 28, 2023

    @ETararenko
    Author

    Did you check the mail server log?

    There are no entries from nextcloud in the mail server logs

  5. joshtrichards commented on Aug 28, 2023

    @joshtrichards
    Member

    I see you enabled mail_smtpdebug. Unfortunately, in order to see the output of that you also need to set your loglevel to 0 in your config.php currently:

    'loglevel' => 0,
    

    Be cautious enabling this since it'll apply to everything occurring on your NC instance, not just email.

  6. ETararenko commented on Aug 28, 2023

    @ETararenko
    Author

    The following message apeared ater enabling 'loglevel' => 0,

    {
      "reqId": "bB28tbjqiCQ0AGP4C030",
      "level": 0,
      "time": "2023-08-28T16:15:30+00:00",
      "remoteAddr": "ip_addr",
      "user": "administrator",
      "app": "core",
      "method": "POST",
      "url": "/index.php/settings/admin/mailtest",
      "message": "Sending mail to \"Array\n(\n    [test@com] => administrator\n)\n\" with subject \"Email setting test\" failed",
      "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36",
      "version": "27.0.2.1",
      "exception": {
        "Exception": "Symfony\\Component\\Mailer\\Exception\\TransportException",
        "Message": "Unable to connect with STARTTLS: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:\nerror:0A000086:SSL routines::certificate verify failed",
        "Code": 0,
        "Trace": [
          {
            "function": "Symfony\\Component\\Mailer\\Transport\\Smtp\\Stream\\{closure}",
            "class": "Symfony\\Component\\Mailer\\Transport\\Smtp\\Stream\\SocketStream",
            "type": "->",
            "args": [
              "*** sensitive parameters replaced ***"
            ]
          },
          {
            "file": "/var/www/html/nextcloud/3rdparty/symfony/mailer/Transport/Smtp/Stream/SocketStream.php",
            "line": 174,
            "function": "stream_socket_enable_crypto"
          },
          {
            "file": "/var/www/html/nextcloud/3rdparty/symfony/mailer/Transport/Smtp/EsmtpTransport.php",
            "line": 115,
            "function": "startTLS",
            "class": "Symfony\\Component\\Mailer\\Transport\\Smtp\\Stream\\SocketStream",
            "type": "->"
          },
          {
            "file": "/var/www/html/nextcloud/3rdparty/symfony/mailer/Transport/Smtp/SmtpTransport.php",
            "line": 253,
            "function": "doHeloCommand",
            "class": "Symfony\\Component\\Mailer\\Transport\\Smtp\\EsmtpTransport",
            "type": "->"
          },
          {
            "file": "/var/www/html/nextcloud/3rdparty/symfony/mailer/Transport/Smtp/SmtpTransport.php",
            "line": 194,
            "function": "start",
            "class": "Symfony\\Component\\Mailer\\Transport\\Smtp\\SmtpTransport",
            "type": "->"
          },
          {
            "file": "/var/www/html/nextcloud/3rdparty/symfony/mailer/Transport/AbstractTransport.php",
            "line": 72,
            "function": "doSend",
            "class": "Symfony\\Component\\Mailer\\Transport\\Smtp\\SmtpTransport",
            "type": "->"
          },
          {
            "file": "/var/www/html/nextcloud/3rdparty/symfony/mailer/Transport/Smtp/SmtpTransport.php",
            "line": 136,
            "function": "send",
            "class": "Symfony\\Component\\Mailer\\Transport\\AbstractTransport",
            "type": "->"
          },
          {
            "file": "/var/www/html/nextcloud/3rdparty/symfony/mailer/Mailer.php",
            "line": 45,
            "function": "send",
            "class": "Symfony\\Component\\Mailer\\Transport\\Smtp\\SmtpTransport",
            "type": "->"
          },
          {
            "file": "/var/www/html/nextcloud/lib/private/Mail/Mailer.php",
            "line": 216,
            "function": "send",
            "class": "Symfony\\Component\\Mailer\\Mailer",
            "type": "->"
          },
          {
            "file": "/var/www/html/nextcloud/apps/settings/lib/Controller/MailSettingsController.php",
            "line": 168,
            "function": "send",
            "class": "OC\\Mail\\Mailer",
            "type": "->"
          },
          {
            "file": "/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
            "line": 230,
            "function": "sendTestMail",
            "class": "OCA\\Settings\\Controller\\MailSettingsController",
            "type": "->"
          },
          {
            "file": "/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
            "line": 137,
            "function": "executeController",
            "class": "OC\\AppFramework\\Http\\Dispatcher",
            "type": "->"
          },
          {
            "file": "/var/www/html/nextcloud/lib/private/AppFramework/App.php",
            "line": 183,
            "function": "dispatch",
            "class": "OC\\AppFramework\\Http\\Dispatcher",
            "type": "->"
          },
          {
            "file": "/var/www/html/nextcloud/lib/private/Route/Router.php",
            "line": 315,
            "function": "main",
            "class": "OC\\AppFramework\\App",
            "type": "::"
          },
          {
            "file": "/var/www/html/nextcloud/lib/base.php",
            "line": 1071,
            "function": "match",
            "class": "OC\\Route\\Router",
            "type": "->"
          },
          {
            "file": "/var/www/html/nextcloud/index.php",
            "line": 36,
            "function": "handleRequest",
            "class": "OC",
            "type": "::"
          }
        ],
        "File": "/var/www/html/nextcloud/3rdparty/symfony/mailer/Transport/Smtp/Stream/SocketStream.php",
        "Line": 171,
        "message": "Sending mail to \"Array\n(\n    [test@com] => administrator\n)\n\" with subject \"Email setting test\" failed",
        "exception": {},
        "CustomMessage": "Sending mail to \"Array\n(\n    [test@com] => administrator\n)\n\" with subject \"Email setting test\" failed"
      }
    }
    
  7. solracsf commented on Aug 28, 2023

    @solracsf
    Member

    See #40073 (comment) as there are 99% chances fix is there.

  8. kesselb commented on Aug 28, 2023

    @kesselb
    Contributor

    Unable to connect with STARTTLS: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:\nerror:0A000086:SSL routines::certificate verify failed

    https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/email_configuration.html#troubleshooting and look for "To disable peer verification".

  9. ZID-TU-Graz-Collab commented on Sep 22, 2023

    @ZID-TU-Graz-Collab

    We are also affected from this issue on NC 27.1.0.

    We use a local MTA (exim4, listing on Port 25), which send the to our internal mail relay. There are following error entries in den exim log:
    TLS error on connection from localhost [127.0.0.1] (gnutls_handshake): Decryption has failed.

  10. kesselb commented on Sep 22, 2023

    @kesselb
    Contributor

    Most likely, your certificate is not valid for localhost / 127.0.0.1.

  11. nextcloud-command commented on Oct 23, 2023

    @nextcloud-command
    Contributor

    This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions.

  12. ZID-TU-Graz-Collab commented on Oct 31, 2023

    @ZID-TU-Graz-Collab

    @kesselb yes, but we use (unencrypted) port 25, since it's an internal mailrelay. it seems that Nextcloud ignores the the "NO"-Encryption setting.

  13. kesselb commented on Oct 31, 2023

    @kesselb
    Contributor

    @ZID-TU-Graz #37329 (comment)

  14. kesselb commented on Oct 31, 2023

    @kesselb
    Contributor

    As written before, we migrated our SMTP library from SwiftMailer to Symfony Mailer.
    Symfony Mailer tries to use StartTLS when announced, it's not possible to opt out.

    Please check the other issues for troubleshooting tips:

    #37329
    #37694
    #38957
    #39452
    #39538

  15. ZID-TU-Graz-Collab commented on Oct 31, 2023

    @ZID-TU-Graz-Collab

    thank you for the info @kesselb

  16. kesselb commented on Oct 31, 2023

    @kesselb
    Contributor

    @ZID-TU-Graz you are welcome, if you need further assistance, please reach out via support.

  17. AlissonSantos95 commented on Jan 29, 2024

    @AlissonSantos95

    thank you, i tryed evrething but not the ipv6 that got online, thank you this helped alot, just did this and worked i even rebuilt the mailcow and nextcloud jesus i'm stupid.

    if you ping your mail.domain.x and brings back ipv6 and your network mainly works on ipv4 do this and it will work:

    Edit /etc/default/grub and append ipv6.disable=1 to GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT like the following sample:

    FROM:

    GRUB_CMDLINE_LINUX_DEFAULT=""
    GRUB_CMDLINE_LINUX=""
    TO:

    GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1"
    GRUB_CMDLINE_LINUX="ipv6.disable=1"

    reboot and it will start work

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions