Hello,
I am trying to send email wia SMTP. When I call method Connect, I have this error:
Rebex.Net.TlsException: Fatal error 'ProtocolVersion' has been encountered on the local connection end. ---> Rebex.Net.TlsException: Fatal error 'ProtocolVersion' has been encountered on the local connection end.
at gbMKS.1UaphuZ.JZ4YLZ()
at gbMKS.1UaphuZ.1rsOcLZ()
--- End of inner exception stack trace ---
at gbMKS.1UaphuZ.1rsOcLZ()
at gbMKS.1UaphuZ.qzm1d()
at Rebex.Net.TlsSocket.Negotiate()
at gbMKS.1AUbEZ.sjyGnZ(TlsParameters )
at Rebex.Net.Smtp.Connect(String serverName, Int32 serverPort, TlsParameters parameters, SmtpSecurity security)
at SMTPTest.MainForm.btnTest_Click(Object sender, EventArgs e) in C:\Projects\Personal\SMTPTest\SMTPTest\SMTPTest\MainForm.cs:line 121
Error data [TlsException.GetData(null)]: 220
I am using Rebex Secure SMTP for .NET (2.0.4444.0).
SMTP server is Microsoft Exchange in Clound.
Server has these requirements:
- Port 25.
- Security TLS 1.1 (IMPLICIT).
- Authentication method NTLM.
My code:
using (Smtp client = new Smtp())
{
MailMessage message = new MailMessage();
try
{
message.From = "my@domain.com"; // I am using real address
message.To = "example@otherdomain.com"; // I am using real address
message.Subject = "TEST";
message.BodyText = "Congratulations. This email was successfully sent.";
TlsParameters tlsParameters = new TlsParameters();
tlsParameters.Version = TlsVersion.TLS11;
tlsParameters.AllowedSuites = TlsCipherSuite.All;
tlsParameters.CertificateVerifier = CertificateVerifier.AcceptAll;
tlsParameters.CommonName = "smtp.myserver.com"; // I am using real SMTP server
client.Connect("smtp.myserver.com", 25, tlsParameters, SmtpSecurity.Implicit);
client.Login(SmtpAuthentication.Ntlm);
client.Send(message);
}
finally
{
client.Disconnect();
}
}
In Microsoft Outlook SMTP with these settings works fine, in my case fails. I tried more options (TLS 1.0, SSL, SmtpSecurity.Explicit) but without result.
With other settings I have these errors:
Rebex.Net.SmtpException: Explicit TLS/SSL is not supported by the SMTP server.
at Rebex.Net.Smtp.1I1Vik(TlsParameters )
at Rebex.Net.Smtp.Connect(String serverName, Int32 serverPort, TlsParameters parameters, SmtpSecurity security)
at SMTPTest.MainForm.btnTest_Click(Object sender, EventArgs e) in C:\Projects\Personal\SMTPTest\SMTPTest\SMTPTest\MainForm.cs:line 121
OR
Rebex.Net.TlsException: Disallowed TLS/SSL protocol version. ---> Rebex.Net.TlsException: Disallowed TLS/SSL protocol version.
at gbMKS.QsaHcZ.RYVUe(Byte[] , Int32 , Int32 , 1RjReZZ )
at gbMKS.QsaHcZ.OnHandshakeReceived(Byte[] buffer, Int32 offset, Int32 count)
at gbMKS.1UaphuZ.2YjOc(Byte[] , Int32 , Int32 )
at gbMKS.1UaphuZ.1rsOcLZ()
--- End of inner exception stack trace ---
at gbMKS.1UaphuZ.1rsOcLZ()
at gbMKS.1UaphuZ.qzm1d()
at Rebex.Net.TlsSocket.Negotiate()
at gbMKS.1AUbEZ.sjyGnZ(TlsParameters )
at Rebex.Net.Smtp.1I1Vik(TlsParameters )
at Rebex.Net.Smtp.Connect(String serverName, Int32 serverPort, TlsParameters parameters, SmtpSecurity security)
at SMTPTest.MainForm.btnTest_Click(Object sender, EventArgs e) in C:\Projects\Personal\SMTPTest\SMTPTest\SMTPTest\MainForm.cs:line 121
Thank You for any suggestion.