Repository navigation
[Bug]: Email could not be sent #40073
Copy link
Copy link
Closed as not planned
Labels
0. Needs triagePending check for reproducibility or if it fits our roadmapPending check for reproducibility or if it fits our roadmap27-feedbackbugfeature: emailsneeds infostaleTicket or PR with no recent activityTicket or PR with no recent activity
Description
⚠️ 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 OR Nextcloud Community Forum (I've searched it).
- Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- I agree to follow Nextcloud's Code of Conduct.
Bug description
A problem occurred while sending the email. Please revise your settings. (Error: Email could not be sent. Check your mail server log).

Share notification mail also could not be sent.
When sharing file, the following message in logging:

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.0Nextcloud 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
Metadata
Metadata
Assignees
Labels
0. Needs triagePending check for reproducibility or if it fits our roadmapPending check for reproducibility or if it fits our roadmap27-feedbackbugfeature: emailsneeds infostaleTicket or PR with no recent activityTicket or PR with no recent activity
Activity
kesselb commentedon Aug 28, 2023
Did you check the mail server log?
[-][Bug]: [/-][+][Bug]: Email could not be sent[/+]kesselb commentedon Aug 28, 2023
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
ETararenko commentedon Aug 28, 2023
There are no entries from nextcloud in the mail server logs
joshtrichards commentedon Aug 28, 2023
I see you enabled
mail_smtpdebug. Unfortunately, in order to see the output of that you also need to set yourloglevelto 0 in yourconfig.phpcurrently:Be cautious enabling this since it'll apply to everything occurring on your NC instance, not just email.
ETararenko commentedon Aug 28, 2023
The following message apeared ater enabling 'loglevel' => 0,
solracsf commentedon Aug 28, 2023
See #40073 (comment) as there are 99% chances fix is there.
kesselb commentedon Aug 28, 2023
https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/email_configuration.html#troubleshooting and look for "To disable peer verification".
ZID-TU-Graz-Collab commentedon Sep 22, 2023
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.
kesselb commentedon Sep 22, 2023
Most likely, your certificate is not valid for localhost / 127.0.0.1.
nextcloud-command commentedon Oct 23, 2023
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.
ZID-TU-Graz-Collab commentedon Oct 31, 2023
@kesselb yes, but we use (unencrypted) port 25, since it's an internal mailrelay. it seems that Nextcloud ignores the the "NO"-Encryption setting.
kesselb commentedon Oct 31, 2023
@ZID-TU-Graz #37329 (comment)
kesselb commentedon Oct 31, 2023
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
ZID-TU-Graz-Collab commentedon Oct 31, 2023
thank you for the info @kesselb
kesselb commentedon Oct 31, 2023
@ZID-TU-Graz you are welcome, if you need further assistance, please reach out via support.
AlissonSantos95 commentedon Jan 29, 2024
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