sendbytes = (size * nmemb);
if (s->bytes_sent >= s->bytes_total) {
- return(0); // we are donez0r
+ return(0); // no data remaining; we are done
}
if (sendbytes > (s->bytes_total - s->bytes_sent)) {
curl_easy_setopt(curl, CURLOPT_READDATA, &s);
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1); // tell libcurl we are uploading
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 20L); // Time out after 20 seconds
- // curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_TRY); athos-mn
+ if (CtdlGetConfigInt("c_smtpclient_try_starttls") != 0) {
+ curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_TRY); // Attempt STARTTLS if offered
+ }
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
// curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_error_buffer);
delete_this_queue = 1;
}
- // If it's been more than five days, give up and tell the sender we #failed
+ // If it's been more than five days, give up and tell the sender that delivery failed
//
else if ((time(NULL) - submitted) > SMTP_DELIVER_FAIL) {
smtp_do_bounce(ChrPtr(NewInstr), SDB_BOUNCE_ALL);
delete_this_queue = 1;
}
- // If it's been more than four hours but less than five days, warn the sender that I've Been Delayed
+ // If it's been more than four hours but less than five days, warn the sender that delivery is delayed
//
else if ( ((attempted - submitted) < SMTP_DELIVER_WARN) && ((time(NULL) - submitted) >= SMTP_DELIVER_WARN) ) {
smtp_do_bounce(ChrPtr(NewInstr), SDB_WARN);
}
-
+
if (delete_this_queue) {
syslog(LOG_DEBUG, "smtpclient: %ld deleting", qmsgnum);
deletes[0] = qmsgnum;