使用libcurl发送电子邮件在Exchange Server上失败

时间:2014-08-22 19:35:07

标签: c++ email curl exchange-server libcurl

我正在尝试使用C ++中的libcurl通过MS Exchange服务器发送简单的电子邮件。程序似乎与服务器连接,正确验证,但在尝试发送程序包时失败并显示错误500 - 未知命令。

我已经验证了服务器地址,libcurl是使用SSL支持编译的,NTLM是受支持的身份验证类型,并且所有电子邮件地址都是有效的。

检查CURL版本返回:

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

该计划报告如下:

* 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'
> 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

我在程序中使用以下连接设置:

curl_easy_setopt(this->curl,CURLOPT_URL, this->address.c_str());
curl_easy_setopt(this->curl,CURLOPT_USERNAME,this->username.c_str());
curl_easy_setopt(this->curl,CURLOPT_PASSWORD,this->username.c_str());
curl_easy_setopt(this->curl,CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_easy_setopt(this->curl,CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
curl_easy_setopt(this->curl,CURLOPT_USE_SSL, CURLUSESSL_ALL);
curl_easy_setopt(this->curl,CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(this->curl,CURLOPT_SSL_VERIFYHOST, 0L);
curl_easy_setopt(this->curl,CURLOPT_UPLOAD, 1L);
curl_easy_setopt(this->curl, CURLOPT_VERBOSE, 1L);  

任何建议都将不胜感激!

0 个答案:

没有答案