title: C++ Sending mail using CSmtp library
body: <p>I'm trying to send email using CSmtp
  <a href="http://www.codeproject.com/Articles/98355/SMTP-Client-with-SSL-TLS" rel="nofollow">http://www.codeproject.com/Articles/98355/SMTP-Client-with-SSL-TLS</a></p>
  
  <p>These lines of code is causing the harm here:  </p>
  
  <pre><code>if((sockAddr.sin_addr.s_addr = inet_addr(szServer)) == INADDR_NONE)
  {
      LPHOSTENT host;
  
      host = gethostbyname(szServer);
      if (host)
          memcpy(&amp;sockAddr.sin_addr,host-&gt;h_addr_list[0],host-&gt;h_length);
      else
      {
  #ifdef LINUX
          close(hSocket);
  #else
          closesocket(hSocket);
  #endif
          throw ECSmtp(ECSmtp::WSA_GETHOSTBY_NAME_ADDR);
      }               
  }
  </code></pre>
  
  <p><code>inet_addr</code> and <code>gethostbyname</code> isn't working anymore.</p>
  
  <pre><code>'inet_addr': Use inet_pton() or InetPton() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
  
  'gethostbyname': Use getaddrinfo() or GetAddrInfoW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
  </code></pre>
  
  <p>How could I get this to work using <code>inet_pton()</code> and <code>getaddrinfo()</code>?
  I have tried to find solution but havent found anything yet so far...</p>
  
  <p>Thanks!</p>