Delivery of messages to mailing list recipients is complete.
[citadel.git] / citadel / modules / listdeliver / serv_listdeliver.c
index f82a8076ce3a0a3bba32d463cd9d6f2af0fd3735..4ceb75a657d8824be0e2ff83de526471d4c4ec7a 100644 (file)
@@ -56,6 +56,7 @@ void listdeliver_do_msg(long msgnum, void *userdata) {
        if (!ld) return;
        char buf[SIZ];
        char *ch;
+       char bounce_to[256];
 
        ld->msgnum = msgnum;
        if (msgnum <= 0) return;
@@ -76,13 +77,6 @@ void listdeliver_do_msg(long msgnum, void *userdata) {
        }
        CM_SetField(TheMessage, eReplyTo, buf, strlen(buf));
 
-       // Errors-to: should be set to our Aide room so we see the notifications.
-
-
-
-
-
-
        // With that out of the way, let's figure out who this message needs to be sent to.
        char *recipients = malloc(strlen(ld->netconf));
        if (recipients) {
@@ -104,10 +98,16 @@ void listdeliver_do_msg(long msgnum, void *userdata) {
                                strcat(recipients, &buf[11]);
                        }
                }
+
+               // Where do we want bounces and other noise to be sent?  Certainly not to the list members!
+               snprintf(bounce_to, sizeof bounce_to, "room_aide@%s", CtdlGetConfigStr("c_fqdn"));
+
+               // Now submit the message
                struct recptypes *valid = validate_recipients(recipients, NULL, 0);
                if (valid) {
-                       long new_msgnum = CtdlSubmitMsg(TheMessage, valid, "");
-                       syslog(LOG_DEBUG, "listdeliver: original message <%ld> is now <%ld> outgoing to the list", msgnum, new_msgnum);
+                       valid->bounce_to = strdup(bounce_to);
+                       valid->envelope_from = strdup(bounce_to);
+                       CtdlSubmitMsg(TheMessage, valid, "");
                        free_recipients(valid);
                }
        }