Closed wilkovanderveen closed 2 years ago
I am getting a System.ObjectDisposedException when i try to send an e-mail in a .NET core 6.0 project:
System.ObjectDisposedException
System.ObjectDisposedException: Cannot access a disposed object. Object name: 'System.Net.Mail.SmtpClient'. at System.Net.Mail.SmtpClient.SendAsync(MailMessage message, Object userToken) at FluentEmail.Smtp.SendMailEx.SendMailExImplAsync(SmtpClient client, MailMessage message, CancellationToken token)
I have tried to inject the smtpclient transient, scoped and as a singleton but niether one of the options fixed this issue.
smtpclient
Never mind. Was my own mistake. I had to inject a custom smtpsender because of an issue with the current version and I had to use a singleton for the other services.
I am getting a
System.ObjectDisposedException
when i try to send an e-mail in a .NET core 6.0 project:I have tried to inject the
smtpclient
transient, scoped and as a singleton but niether one of the options fixed this issue.