libcurl 是否支持发送不加密的电子邮件?
Does libcurl support sending e-mail without any encryption?
我们有一个通过交换服务器发送通知电子邮件的应用程序。现在,如果交换配置为 SSL 或 TLS 加密,我们就可以发送邮件。如果没有为任何加密配置交换,应用程序将无法发送邮件。问题是
- Libcurl 是否支持发送未加密的电子邮件?
我们正在使用 Wireshark,发现它使用 StartTLS 发送邮件。
下面是我们用来发送邮件的代码片段:
curl_easy_setopt(curl, CURLOPT_URL, "smtp.url.com:25");
curl_easy_setopt(curl, CURLOPT_LOGIN_OPTIONS, "AUTH=NTML PLAIN");
curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password");
curl_easy_setopt(curl, CURLOPT_MAIL_FROM, FROM_ADDR);
recipients = curl_slist_append(recipients, TO_ADDR);
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);
curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source);
curl_easy_setopt(curl, CURLOPT_READDATA, &upload_ctx);
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
res = curl_easy_perform(curl);
请让我知道我们在这里缺少什么。
如果我们添加 CURLOPT_USE_SSL 和 CURLUSESSL_NONE,如下所示,它有效。
if(<condition to mark that mail is using no encryption>)
curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_NONE);
我们有一个通过交换服务器发送通知电子邮件的应用程序。现在,如果交换配置为 SSL 或 TLS 加密,我们就可以发送邮件。如果没有为任何加密配置交换,应用程序将无法发送邮件。问题是
- Libcurl 是否支持发送未加密的电子邮件?
我们正在使用 Wireshark,发现它使用 StartTLS 发送邮件。 下面是我们用来发送邮件的代码片段:
curl_easy_setopt(curl, CURLOPT_URL, "smtp.url.com:25");
curl_easy_setopt(curl, CURLOPT_LOGIN_OPTIONS, "AUTH=NTML PLAIN");
curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password");
curl_easy_setopt(curl, CURLOPT_MAIL_FROM, FROM_ADDR);
recipients = curl_slist_append(recipients, TO_ADDR);
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);
curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source);
curl_easy_setopt(curl, CURLOPT_READDATA, &upload_ctx);
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
res = curl_easy_perform(curl);
请让我知道我们在这里缺少什么。
如果我们添加 CURLOPT_USE_SSL 和 CURLUSESSL_NONE,如下所示,它有效。
if(<condition to mark that mail is using no encryption>)
curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_NONE);