FluentEmail
FluentEmail copied to clipboard
SMTP returning 'The remote certificate is invalid according to the validation procedure.' because of Sender.UseSsl
I am using a SMTP mock (node fake-smtp-server) to test FluentEmail.Core with SMTP sender. I am using the config file to define the SMTP configuration. My intention is to not have any additional SMTP configuration in my code. My configuration file is as follows:
<system.net>
<mailSettings>
<smtp deliveryMethod="Network">
<network host="localhost" port="25" enableSsl="false" />
</smtp>
</mailSettings>
</system.net>
My mock is launched as follows:
fake-smtp-server --smtp-port 25 --http-port 10080 --max 10
The default value for Sender.UseSsl is true, so I am forced to use the following to configure SMTP:
var _defaultClient = new SmtpClient();
var _sender = new SmtpSender(_defaultClient);
_sender.UseSsl = false;
Additionally, is FluentEmail.Core a replacement of FluentEmail? Explanations in the docs would be appreciated.
My work-around:
var _client = new SmtpClient();
var _sender = new SmtpSender(_client)
{
UseSsl = _client.EnableSsl
};