Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Asim 4 posts 84 karma points
    Mar 27, 2023 @ 23:55
    Asim
    0

    CMS email issues: An error occurred while attempting to establish an SSL or TLS connection

    We have recently been migrating from v8 to v10 and while most troubled situations have been resolved a couple issues remain. One of the issues is the SMTP Settings, or to be more frank I'm not even sure if that's the issue.

    In v8 we had email notifications functioning properly for a little over a year. Ex: user makes changes to page, selects "send to publish", admins get email from CMS that a page is ready to publish, etc. Forms workflows also worked great utilizing the email function.

    In v10 we simply can't get the same email function to work.

    in appsettings.json the configuration is set as follows

    "Umbraco": {
        "Global": {
            "Smtp": {
                "From": "[email protected]",
                "Host": "mail.orgname.org",
                "Port": 587
            }
        },
    }
    

    Also here:

    "Umbraco": {
        "Content": {
            "Notifications": {
              "Email": "[email protected]"
            },
        }
    }
    

    When running Health Check all seems well:

    Check passed: SMTP settings are configured correctly and the service is operating as expected.
    

    When a user selects "send to publish" the following error shows up in the log (3 times in a row):

    MailKit.Security.SslHandshakeException: An error occurred while attempting to establish an SSL or TLS connection.
    
    The server's SSL certificate could not be validated for the following reasons:
    • The server certificate has the following errors:
      • The revocation function was unable to check revocation for the certificate.
      • The revocation function was unable to check revocation because the revocation server was offline.
    • The root certificate has the following errors:
      • The revocation function was unable to check revocation for the certificate.
      • The revocation function was unable to check revocation because the revocation server was offline.
    
     ---> System.Security.Authentication.AuthenticationException: The remote certificate was rejected by the provided RemoteCertificateValidationCallback.
       at System.Net.Security.SslStream.SendAuthResetSignal(ProtocolToken message, ExceptionDispatchInfo exception)
       at System.Net.Security.SslStream.CompleteHandshake(SslAuthenticationOptions sslAuthenticationOptions)
       at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](TIOAdapter adapter, Boolean receiveFirst, Byte[] reAuthenticationData, Boolean isApm)
       at MailKit.Net.Smtp.SmtpClient.ConnectAsync(String host, Int32 port, SecureSocketOptions options, Boolean doAsync, CancellationToken cancellationToken)
       --- End of inner exception stack trace ---
       at MailKit.Net.Smtp.SmtpClient.ConnectAsync(String host, Int32 port, SecureSocketOptions options, Boolean doAsync, CancellationToken cancellationToken)
       at Umbraco.Cms.Infrastructure.Mail.EmailSender.SendAsyncInternal(EmailMessage message, String emailType, Boolean enableNotification)
       at Umbraco.Cms.Infrastructure.Mail.EmailSender.SendAsync(EmailMessage message, String emailType)
       at Umbraco.Cms.Core.Services.NotificationService.<>c__DisplayClass30_0.<Process>b__0(Object state)
    

    These are the same settings as we had used in the older versions in web.config which worked fine, however setup in appsettings.json in v10 we can't get it to work... Switching back to v8 once again resumes the email functionality just fine.

    If anyone has insight on this I would greatly appreciate it as I'm pretty much out of ideas at this point.

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Mar 28, 2023 @ 06:58
    Huw Reddick
    100

    What email settings do you have for v8? Are they identical to the ones you show above?

  • Asim 4 posts 84 karma points
    Mar 28, 2023 @ 15:25
    Asim
    0

    Similar, here's the v8 settings, only difference is we didn't specify the port and used IP for network host. Using IP for "Host" in v10 settings clears health check but still fails to send email

    v8 settings, all emails send just fine with these:

    in web.config:

    <smtp from="[email protected]">
            <network host="***.***.**.***" userName="" password="" />
          </smtp>
    

    in umbracoSettings.config

    <notifications>
          <email>[email protected]</email>
        </notifications>
    
  • Asim 4 posts 84 karma points
    Mar 28, 2023 @ 16:10
    Asim
    0

    Accidentally marked this as solution... can't unmark it, still having the issue.

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Mar 28, 2023 @ 16:20
    Huw Reddick
    0

    what happens in 10 if you set the port to 25?

  • Asim 4 posts 84 karma points
    Mar 28, 2023 @ 16:45
    Asim
    0

    So that actually worked but with a caveat.

    The final appsetting.json looks like this:

    "Umbraco": {
        "Global": {
            "Smtp": {
                "From": "[email protected]",
                "Host": "mail.orgname.org",
                "Port": 25,
                "SecureSocketOptions": "None"
            }
        },
    }
    

    Port 25 didn't work before without "SecureSocketOptions": "None"

    The solution was hunted down eventually thanks to this: https://codeshare.co.uk/blog/how-to-send-emails-in-umbraco-9-using-iemailsender/

  • Huw Reddick 1929 posts 6697 karma points MVP 2x c-trib
    Mar 28, 2023 @ 16:54
    Huw Reddick
    0

    Seems a bit odd that you need to set securesocketoptions to none since port 25 does not use any kind of secure socket, I have never had to use it when testing using a local SMTP on port 25

Please Sign in or register to post replies

Write your reply to:

Draft