/*
* Make sure it's set to be a "system room" so it doesn't show up
- * in the <K>nown rooms list for Aides.
+ * in the <K>nown rooms list for administrators.
*/
if (CtdlGetRoomLock(&qrbuf, SMTP_SPOOLOUT_ROOM) == 0) {
qrbuf.QRflags2 |= QR2_SYSTEM;
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_SSL_VERIFYPEER, 0L);
+ curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
strcpy(try_this_mx, "smtp://");
extract_token(&try_this_mx[7], mxes, i, '|', (sizeof try_this_mx - 7));
+ if (
+ (!strncasecmp(try_this_mx, HKEY("smtp://smtp://"))) // This can happen if the administrator
+ || (!strncasecmp(try_this_mx, HKEY("smtp://smtps://"))) // puts a full smtp[s] URI as the smart-host
+ ) {
+ strcpy(try_this_mx, &try_this_mx[7]);
+ }
+
curl_easy_setopt(curl, CURLOPT_URL, try_this_mx);
syslog(LOG_DEBUG, "smtpclient: trying %s", try_this_mx); // send the message
response_code = 421;
}
- curl_slist_free_all(recipients);
+ if (recipients != NULL) {
+ curl_slist_free_all(recipients);
+ }
curl_easy_cleanup(curl);
}
}
long deletes[2];
int delete_this_queue = 0;
- syslog(LOG_DEBUG, "smtpclient: smtp_process_one_msg(%ld)", qmsgnum);
+ syslog(LOG_DEBUG, "smtpclient: processing queue entry %ld", qmsgnum);
msg = CtdlFetchMessage(qmsgnum, 1, 1);
if (msg == NULL) {
char *bounceto = NULL;
char *envelope_from = NULL;
- // Example queue instructions
- //
- // msgid|3978
- // submitted|1489343934
- // bounceto|IGnatius T Foobar@dev
- // attempted|1489344257
- // remote|unreachable@example.com|4|Timeout while connecting example.com [93.184.216.34]:25
- // remote|unreachable@example.org|4|Timeout while connecting example.org [93.184.216.34]:25
- // remote|unreachable@example.gov|0|1) A-lookup example.gov - Domain name not found; 2) AAAA-lookup example.gov - Domain name not found;
-
char cfgline[SIZ];
for (i=0; i<num_tokens(instr, '\n'); ++i) {
extract_token(cfgline, instr, i, '\n', sizeof cfgline);
}
if (should_try_now) {
- syslog(LOG_DEBUG, "smtpclient: attempting delivery");
-
+ syslog(LOG_DEBUG, "smtpclient: attempting delivery now");
StrBuf *NewInstr = NewStrBuf();
StrBufAppendPrintf(NewInstr, "Content-type: "SPOOLMIME"\n\n");
StrBufAppendPrintf(NewInstr, "msgid|%ld\n", msgid);
FreeStrBuf(&NewInstr); // We have to free NewInstr here, no longer needed
}
else {
- // replace the old qmsg with the new one
+ // replace the old queue entry with the new one
syslog(LOG_DEBUG, "smtpclient: rewriting this queue entry");
msg = convert_internet_message_buf(&NewInstr); // This function will free NewInstr for us
CtdlSubmitMsg(msg, NULL, SMTP_SPOOLOUT_ROOM, 0);
if (bounceto != NULL) free(bounceto);
if (envelope_from != NULL) free(envelope_from);
free(instr);
-
}
int i = 0;
/*
- * This is a simple concurrency check to make sure only one pop3client
+ * This is a simple concurrency check to make sure only one smtpclient
* run is done at a time. We could do this with a mutex, but since we
* don't really require extremely fine granularity here, we'll do it
* with a static variable instead.