当我运行curl命令而不是它的工作时。
但是当我在curl smtp-tls.c 中运行示例而不是我收到错误。
这是输出。
输出
Rebuilt URL to: smtp.office365.com:587/
* Hostname was NOT found in DNS cache
* Trying 111.221.114.166...
* Connected to smtp.office365.com (111.221.114.166) port 587 (#0)
< 220 HKNPR03CA002.outlook.office365.com Microsoft ESMTP MAIL Service ready at Mon, 13
Oct 2014 11:00:16 +0000
> EHLO bhagirath-OptiPlex-390
< 250-HKNPR03CA002.outlook.office365.com Hello [14.140.152.42]
< 250-SIZE 78643200
< 250-PIPELINING
< 250-DSN
< 250-ENHANCEDSTATUSCODES
< 250-STARTTLS
< 250-8BITMIME
< 250-BINARYMIME
< 250 CHUNKING
> MAIL FROM:<abc@xyz.com>
< 530 5.7.1 Client was not authenticated
* MAIL failed: 530
> QUIT
* response reading failed
* Closing connection 0
curl_easy_perform() failed: Failed sending data to the peer
请帮助解决这个问题。
感谢。
答案 0 :(得分:0)
您必须没有为smtp服务器设置用户名\密码。 您需要执行以下操作:
curl_easy_setopt(curl, CURLOPT_USERNAME, "user");
curl_easy_setopt(curl, CURLOPT_PASSWORD, "secret");