Closed gsig91 closed 6 months ago
I also have this problem, please fix it.
I also have this problem I am able to send emails with MailKit using SecureSocketOptions.None (as required by my server) but that is not available in EmailConnectionInfo. Setting EnableSsl = false seems to cause it to try to use TLS = true.
Edit: the dev version works correctly I had bug in my code. Any ETA for the dev version to become a release version?
With the dev version using
SecureSocketOption = Serilog.Sinks.Email.SecureSocketOptions.StartTls
I'm getting
Failed to send email: MailKit.Security.AuthenticationException: 535: 5.7.3 Authentication unsuccessful [LO2P265CA0295.GBRP265.PROD.OUTLOOK.COM] ---> MailKit.Net.Smtp.SmtpCommandException: 5.7.3 Authentication unsuccessful [LO2P265CA0295.GBRP265.PROD.OUTLOOK.COM] --- End of inner exception stack trace --- at MailKit.Net.Smtp.SmtpClient.AuthenticateAsync(Encoding encoding, ICredentials credentials, Boolean doAsync, CancellationToken cancellationToken) at MailKit.Net.Smtp.SmtpClient.Authenticate(Encoding encoding, ICredentials credentials, CancellationToken cancellationToken) at Serilog.Sinks.Email.EmailSink.OpenConnectedSmtpClient(
When sending via Mailkit directly using
client.Connect(EmailSettings.Host, EmailSettings.Port, SecureSocketOptions.StartTls);
works correctly
Seems the issue still persists.
Using the latest devbuild of the nuget package, this does indeed still fail. I've tried a number of work arounds (since I can't force a change to the exchange server) and short of brute forcing it by cloning this repo and adding
connectionInfo.SecureSocketOption = SecureSocketOptions.None;
connectionInfo.ServerCertificateValidationCallback = (senderX, certificate, chain, sslPolicyErrors) => true;
I can't get it to work.
The workaround suggested by Jay (https://stackoverflow.com/a/64649322/6826260) worked
Using this dev branch nuget package as this pull request comment suggests worked for me flawlessly.
Version 3.0.0-dev-* now sorts this out. HTH!
Hello,
is there a way to use the SecureSocketOptions option when initializing the smtp client.
I am facing an issue when initialing the logger in my Program.cs with my asp.net core application
A custom Mailkit smtp client can connect to the remote SMTP just by using the "SecureSocketOptions" overload.
Related stackoverflow issue (https://stackoverflow.com/questions/56833042/serilog-email-sink-enablessl-false-checks)
Any suggestions would be much appreciated, thanks in advance,