Emails not sending - 'sending', 'waiting', 'failed'.
Encountering challenges with email delivery can hinder the effectiveness of communication and impact various aspects of your Kentico-powered applications. This knowledge base article aims to guide users through the process of troubleshooting common reasons behind emails not sending within the Kentico environment.
In this article I dive into troubleshooting the email queue that either gets stuck in 'sending', 'waiting', or 'failed'.
First there has been some changes to the email queue recently and it requires all emails to SMTP to require a SSL Certificate. Your SMTP server must be compliant meaning that you it needs to support SSL.
The first step to rule out before I address any of the errors on why your emails are not sending. Try setting the SMTP server to 'localhost' and download the PaperCut SMTP server, found here: GitHub - ChangemakerStudios/Papercut-SMTP: Papercut SMTP -- The Simple Desktop Email Server. However, there is an alternative to PaperCut and if you'd like to use it, this can also be good for testing whether it's a Kentico or a SMTP issue: rnwood/smtp4dev: smtp4dev - the fake smtp email server for development and testing (github.com) If the emails are sending using these SMTPs listed above, it is due to your SMTP server which is out of Kentico support scope.
Check our hotfix for the version you're using: Hotfixes (kentico.com), there have been a lot of hotfixes address the email server issues and hotfixes have been released to fix the issues. If you have applied to the latest hotfix, ensure the NuGet packages on your project have also been updated to match the Hotfix version you're using. With the hotfix 13.0.80 and 12.0.101 the checkbox to use SSL was removed because a secure connection is required by default now due to modern SMTPs requiring a valid SSL certificate and SSL connection. The NuGet package MailKit was included in the install, this library provides additional options for configuring your connection. Information on MailKit is available on their GitHub repo here: MailKit/FAQ.md at master · jstedfast/MailKit (github.com)
Vast majority of SMTP Servers is using SSL and/or more secure ways of connection. In your case, if your SMTP server is in some secured environment and you are not using SSL and you do not want to use OAuth tokens for authentication, then you need to override the provider and use the ISmtpClientFactory (this was added also in one of the last K12 hotfixes) to change the SecureSocketOptions settings e.g. to "None" as explained in the GitHub link. The idea is similar to custom email provider, at least in the way of adding custom class library: Custom Email provider example | Xperience 13 Documentation and then here is an example of how to set the certificate validation: MailKit/MailKit/Net/Smtp/SmtpClient.cs at 3.3.0 · jstedfast/MailKit (github.com)
Another common suggestion is that your site may have zero activity at the time of email sending, so it's possible that the emails are not because the site has had no requests to keep it running. If you are using scheduled tasks to send emails, you may try the CMSUseAutomaticScheduler web.config key to see if this helps, see our documentation page: Reference - Web.config application keys | Xperience 13 Documentation. See what our documentation says about Scheduler reliability here: Scheduler reliability
Restarting the Kentico app helps, by going System -> Restart application.
Lastly, I would suggest to read all that is on this documentation page: Configuring SMTP servers | Xperience 13 Documentation.
If you are still having issues please reach out to our Support Engineers with the status of your Webfarms and the Event Log.