SMTP, Windows Store App issue

Feb 22, 2013 at 5:53 PM
I created a Windows Store App and tried to send a mail via SMTP by the follwing code:
            using (var cl = new SmtpClient())
                cl.ServerName = "";
                cl.Port = 465;
                cl.Ssl = true;
                cl.AuthenticateMode = SmtpAuthenticateMode.Auto;
                cl.UserName = "";
                cl.Password = "xxx";

                SmtpMessage mg = new SmtpMessage();
                mg.From = "";
                mg.To.Add(new MailAddress(""));
                mg.Subject = "Test";
                mg.BodyText = "test";
                mg.IsHtml = true;
The sendMail row throws the following Exception : The host was not reachable for a socket operation.
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at HigLabo.Net.SocketClient.ExecuteAsyncTask(Task task)
   at HigLabo.Net.SocketClient.SetSocket()
   at HigLabo.Net.SocketClient.Connect()
   at HigLabo.Net.Smtp.SmtpClient.Open()
   at HigLabo.Net.Smtp.SmtpClient.EnsureOpen()
   at HigLabo.Net.Smtp.SmtpClient.SendMailList(IEnumerable`1 commandList)
   at HigLabo.Net.Smtp.SmtpClient.SendMail(SendMailCommand command)
   at HigLabo.Net.Smtp.SmtpClient.SendMail(SmtpMessage message)
I used the HigLabo.Mail.WindowsRT Libary.
Thank you so much.
Feb 23, 2013 at 8:53 AM
Please confirm if you did succeed sending messages in telnet mode from the same server.
Feb 23, 2013 at 9:05 AM
What does you mean with sending in telnet mode?
I tried other ways of connecting to the smtp server (StreamSocket for instance), but i get each time the same exception.
So could i make something wrong with the connection itself?
Feb 23, 2013 at 9:56 AM
Please call Authenticate method before execute SendMail method.

And Change this line.
mg.From = ""; To this.
mg.From = "";

It may solve problem.

Feb 23, 2013 at 12:55 PM
Edited Feb 23, 2013 at 1:50 PM
Thanks for your fast help, but the issue is still there.
I changed as you recommended the line
cl.SendMail() to

if (cl.Authenticate())

But i get the same exception from the call of the Authenticate() method now.
Feb 25, 2013 at 5:03 AM
Edited Feb 25, 2013 at 5:04 AM
I could not reproduct your bug in my environment.
I can send a mail to my GMail account.

Please confirm network connectivity by using telnet with command prompt as BravoSierra said or confirm by other way.
And Please change "" to "<<>";

Apr 7, 2013 at 5:59 PM
I don't know why, but now it works. I tested also your Libary for the .Net Framework 3.5 and I found the Option to ignore Certificates (for example pop3client.RemoteCertificateValidationCallback). Is there a way to use something like that in windows rt?