We have an application which sends notification email through exchange server. Right now if exchange is configured for SSL or TLS encryption, we are able to send the mail. If exchange is not configured for any encryption, the application is failing to send mail. The question is
- Does Libcurl support sending email without encryption?
We were using Wireshark and found that it using StartTLS for sending the mail. Below is the code snippet we are using to send mail:
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);
Please let me know what are we missing here.
CURLOPT_USE_SSLoption. What version of libcurl are you using, though? libcurl honors an SMTP server'sSTARTTLScapability and has done so since early 2013. Prior to that, libcurl would sendSTARTTLSwhether the server supported it or not.STARTTLSon SMTP is not generally used on port 25, usually on port 587 instead. - Remy LebeauSTARTTLSwill be used, unless you disable SSL viaCURLOPT_USE_SSLor recompiling libcurl without SSL support. If libcurl is sendingSTARTTLSwhenCURLOPT_USE_SSLis set toCURLUSESSL_NONE, I would consider that a bug that should be reported. - Remy Lebeau