Smtp 无法使用libcurl发送电子邮件 CURL *curl; CURLcode curlres; struct curl_slist *recipients = NULL; char from[128] = "<no-reply@mydomain.com>"; char to[128] = "someuser@gmail.com"; curl = curl_easy_init(); curl_easy_setopt(curl, CURLOPT_URL, COOLCAST_MAILER_URL); curl_easy_setopt(curl, CURLOPT_MAIL_FROM, from); recipients = curl_slist_append(recipients, to); curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients); curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source); curl_easy_setopt(curl, CURLOPT_READDATA, NULL); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); curlres = curl_easy_perform(curl); if(curlres != CURLE_OK) qDebug() << "Encountered error in sending email";
似乎我的Smtp 无法使用libcurl发送电子邮件 CURL *curl; CURLcode curlres; struct curl_slist *recipients = NULL; char from[128] = "<no-reply@mydomain.com>"; char to[128] = "someuser@gmail.com"; curl = curl_easy_init(); curl_easy_setopt(curl, CURLOPT_URL, COOLCAST_MAILER_URL); curl_easy_setopt(curl, CURLOPT_MAIL_FROM, from); recipients = curl_slist_append(recipients, to); curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients); curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source); curl_easy_setopt(curl, CURLOPT_READDATA, NULL); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); curlres = curl_easy_perform(curl); if(curlres != CURLE_OK) qDebug() << "Encountered error in sending email";,smtp,libcurl,Smtp,Libcurl,似乎我的libcurl用法的真正问题是-它试图发出VRFY,而我希望它使用RCPT to-这就是我在telnet会话中所做的。有没有办法在libcurl中设置该选项?或者代码还有其他问题吗?尝试添加 curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); 请参见尝试添加 curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); 请参见尝试添加 curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
libcurl
用法的真正问题是-它试图发出VRFY,而我希望它使用RCPT to-这就是我在telnet会话中所做的。有没有办法在libcurl
中设置该选项?或者代码还有其他问题吗?尝试添加
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
请参见尝试添加
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
请参见尝试添加
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
请参见尝试添加
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
看