I am trying to connect to an SMTP server from a .NetCore/Ubuntu machine via Mailkit.
I am attempting to connect to port 25 on the server with SSL turned off.
The mail server is a windows server on the local lan, and works fine from other machines with the same settings as are being used on the problem Ubuntu machine.
The code being used to connect is as follows:
using (var client = new SmtpClient())
{
client.Connect("smtp.mydomain.com", 25,false);
client.Authenticate(username, password);
client.Send(emailMessage);
client.Disconnect(true);
}
However, this throws an exception immediately after the .Connect line with the error message "The remote certificate is invalid according to the validation procedure."
I am surprised that certificates are involved at all on vanilla port 25.
Has anyone got any ideas what is going on?