C#

C#

Made by DeepSource

Consider using SSL when dealing with SMTP CS-S1003

Security
Major
a02 cwe-200 cwe-319 owasp top 10

The SMTP class in System.Net.Mail lets you send email using the Simple Mail Transfer Protocol (SMTP). By default, it does not use Secure Sockets Layer (SSL) to encrypt the connection. It is therefore recommended that you enable SSL to secure your application and its data transmission.

Bad Practice

var smtp = new SmtpClient(host, port);

Recommended

var smtp = new SmtpClient(host, port)
{
    EnableSsl = true
};

Reference