title: Why am I getting an exception Failure when trying to send an email using smtp?
body: <pre><code>public void sendit()
          {
              try
              {
  
                  SmtpClient mySmtpClient = new SmtpClient("out.bezeqint.net");
  
                  // set smtp-client with basicAuthentication
                  mySmtpClient.UseDefaultCredentials = false;
                  mySmtpClient.Port = 110;
                  mySmtpClient.EnableSsl = true;
                  System.Net.NetworkCredential basicAuthenticationInfo = new
                     System.Net.NetworkCredential("myuser", "mypass");
                  mySmtpClient.Credentials = basicAuthenticationInfo;
  
                  // add from,to mailaddresses
                  MailAddress from = new MailAddress("test@bezeqint.net", "TestFromName");
                  MailAddress to = new MailAddress("test@bezeqint.net", "TestToName1");
                  MailMessage myMail = new System.Net.Mail.MailMessage(from, to);
  
                  // add ReplyTo
                  MailAddress replyto = new MailAddress("test@bezeqint.net");
                  myMail.ReplyToList.Add(replyto);
  
                  // set subject and encoding
                  myMail.Subject = "Test message";
                  myMail.SubjectEncoding = System.Text.Encoding.UTF8;
  
                  // set body-message and encoding
                  myMail.Body = "&lt;b&gt;Test Mail&lt;/b&gt;&lt;br&gt;using &lt;b&gt;HTML&lt;/b&gt;.";
                  myMail.BodyEncoding = System.Text.Encoding.UTF8;
                  // text or html
                  myMail.IsBodyHtml = true;
  
                  mySmtpClient.Send(myMail);
              }
  
              catch (SmtpException ex)
              {
                  throw new ApplicationException
                    ("SmtpException has occured: " + ex.Message);
              }
              catch (Exception ex)
              {
                  throw ex;
              }
          }
  </code></pre>
  
  <p>The exception happen in the first catch.</p>
  
  <pre><code>"Failure sending mail."
  
  StackTrace
  
  at System.Net.Mail.SmtpClient.Send(MailMessage message)
     at Emails\SendEmail.cs:line 150
  </code></pre>
  
  <p>Line 150 is</p>
  
  <pre><code>mySmtpClient.Send(myMail);
  </code></pre>
  
  <p>The client bezeqint is pop3 at least for getting/downloading emails I'm using openpop. But to send emails I'm using smtp and getting the exception.</p>
  
  <p>In top of form1 </p>
  
  <pre><code>using System.Net.Mail;
  </code></pre>
  
  <p>More info about the exception:</p>
  
  <p>[System.Net.WebException] = {"Unable to connect to the remote server"}</p>
  
  <p>And StackTrace</p>
  
  <pre><code>at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress&amp; address, Socket&amp; abortSocket, Socket&amp; abortSocket6)
     at System.Net.PooledStream.Activate(Object owningObject, Boolean async, GeneralAsyncDelegate asyncCallback)
     at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback)
     at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout)
     at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)
     at System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint)
     at System.Net.Mail.SmtpClient.GetConnection()
     at System.Net.Mail.SmtpClient.Send(MailMessage message)
  </code></pre>
  
  <p>And InnerException</p>
  
  <p>InnerException = {"A connection attempt failed because the connected party did not properly respond after a period of time or established connection failed because connected host has failed to respond 192.115.187.185:110"}</p>