[Mono-dev] sending smtp email under SSL

Gerard Webb gedw99 at hotmail.com
Thu Dec 27 16:22:49 EST 2007


Hey,
 
i am trying to send an email using a gmail account.
According to the docs, Network Credentials does not support SSL.
http://www.go-mono.com/docs/index.aspx?link=T%3ASystem.Net.NetworkCredential%2F*
 
I am using the latest mono 1.2, and XPS2 !
Is there an alternative way to send email under SSL ????
 
Code and error below::::
 
 
SmtpClient mailClient = new SmtpClient();
mailClient.EnableSsl = true;
mailClient.DeliveryMethod = SmtpDeliveryMethod.Network;
mailClient.Host = "smtp.gmail.com";
mailClient.Port = 587;
mailClient.Credentials = new NetworkCredential(Config.GMAIL_UserName, Config.GMAIL_PassWord);
mailClient.Send(this._from, this._to, this._subject, this._body);
 
THis fails with:
 
Server Error in '/' Application


SSL authentication error: RemoteCertificateChainErrors
Description: Error processing request.
Error Message: HTTP 500. System.InvalidOperationException: SSL authentication error: RemoteCertificateChainErrors 
Stack Trace: 




System.InvalidOperationException: SSL authentication error: RemoteCertificateChainErrors  at System.Net.Mail.SmtpClient.<SmtpClient>c__38 (System.Object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, SslPolicyErrors sslPolicyErrors) [0x00000]   at System.Net.Security.SslStream+<>c__CompilerGenerated13.<BeginAuthenticateAsClient>c__44 (System.Security.Cryptography.X509Certificates.X509Certificate cert, System.Int32[] certErrors) [0x00000]   at Mono.Security.Protocol.Tls.SslClientStream.OnRemoteCertificateValidation (System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Int32[] errors) [0x00000]   at Mono.Security.Protocol.Tls.SslStreamBase.RaiseRemoteCertificateValidation (System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Int32[] errors) [0x00000]   at Mono.Security.Protocol.Tls.SslClientStream.RaiseServerCertificateValidation (System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Int32[] certificateErrors) [0x00000]   at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.validateCertificates (Mono.Security.X509.X509CertificateCollection certificates) [0x00000]   at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1 () [0x00000]   at Mono.Security.Protocol.Tls.Handshake.HandshakeMessage.Process () [0x00000]   at (wrapper remoting-invoke-with-check) Mono.Security.Protocol.Tls.Handshake.HandshakeMessage:Process ()  at Mono.Security.Protocol.Tls.ClientRecordProtocol.ProcessHandshakeMessage (Mono.Security.Protocol.Tls.TlsStream handMsg) [0x00000]   at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20071227/18cbbd01/attachment.html 


More information about the Mono-devel-list mailing list