I have this class which sends emails to SMTP servers. When managing our own SMTP servers, either locally or across the Internet, sending emails was a walk in the park, as far as performance goes. I could send dozens of emails within seconds. Now, I have an implementation which goes to Office 365 with SSL authentication. Each email takes 3 seconds to be delivered. I am trying to know if the bottleneck is because there is now SSL, if this is because of the backend, or a mix of both.
The class uses an approach like this:
Dim loEmail As MailMessage = New MailMessage
Dim loNetworkCredential As System.Net.NetworkCredential = Nothing
Dim loSmtpClient As SmtpClient = New SmtpClient
loEmail.Subject = cSubject
loEmail.Body = cBody
loSmtpClient.Host = cSMTP
loSmtpClient.Port = nPort
loSmtpClient.EnableSsl = lEnableSsl
If lEnableSsl Then
loNetworkCredential = New System.Net.NetworkCredential(cUsername, cPassword)
loSmtpClient.Credentials = loNetworkCredential
End If