title: Sending Email With libcurl fails Over Exchange Server
body: <p>I am attempting to send a simple email message using libcurl in C++ over a MS Exchange server. The program seems to connect with the server, authenticate correctly, but fails with error 500 - unknown command when attempting to send the package. </p>
  
  <p>I have verified the server address, that libcurl was compiled with SSL support, NTLM is supported authentication type, and all the email addresses are valid.  </p>
  
  <p>Checking the CURL version returns:</p>
  
  <pre><code>curl 7.37.1 (armv5tejl-unknown-linux-gnueabi) libcurl/7.37.1 OpenSSL/0.9.8o zlib/1.2.3.4
  Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smtp smtps telnet tftp
  Features: IPv6 Largefile NTLM NTLM_WB SSL libz
  </code></pre>
  
  <p>And the program reports the following: </p>
  
  <pre><code>* Rebuilt URL to: mail.domain.net:587/
  * Hostname was NOT found in DNS cache
  *   Trying 192.168.0.114...
  * Connected to mail.domain.net (192.168.0.114) port 587 (#0)
  * Server auth using NTLM with user 'redmine'
  &gt; PUT / HTTP/1.1
  Authorization: NTLM TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=
  Host: mail.iem.net:587
  Accept: */*
  Content-Length: 0
  
  220 mail.domain.net Microsoft ESMTP MAIL Service ready at Fri, 22 Aug 2014 15:20:09 -0400
  500 5.3.3 Unrecognized command
  500 5.3.3 Unrecognized command
  500 5.3.3 Unrecognized command
  500 5.3.3 Unrecognized command
  500 5.3.3 Unrecognized command
  421 4.7.0 Too many errors on this connection, closing transmission channel
  * Connection #0 to host mail.iem.net left intact
  </code></pre>
  
  <p>I'm using the following connection settings in the program:</p>
  
  <pre><code>curl_easy_setopt(this-&gt;curl,CURLOPT_URL, this-&gt;address.c_str());
  curl_easy_setopt(this-&gt;curl,CURLOPT_USERNAME,this-&gt;username.c_str());
  curl_easy_setopt(this-&gt;curl,CURLOPT_PASSWORD,this-&gt;username.c_str());
  curl_easy_setopt(this-&gt;curl,CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
  curl_easy_setopt(this-&gt;curl,CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
  curl_easy_setopt(this-&gt;curl,CURLOPT_USE_SSL, CURLUSESSL_ALL);
  curl_easy_setopt(this-&gt;curl,CURLOPT_SSL_VERIFYPEER, 0L);
  curl_easy_setopt(this-&gt;curl,CURLOPT_SSL_VERIFYHOST, 0L);
  curl_easy_setopt(this-&gt;curl,CURLOPT_UPLOAD, 1L);
  curl_easy_setopt(this-&gt;curl, CURLOPT_VERBOSE, 1L);  
  </code></pre>
  
  <p>Any suggestions would be greatly appreciated!</p>