]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
add modemailsender option for sender moderation
authorMichael S. Tsirkin <mst@redhat.com>
Sun, 24 Aug 2025 17:45:28 +0000 (13:45 -0400)
committerbapt <bapt@noreply.codeberg.org>
Wed, 12 Nov 2025 16:34:57 +0000 (17:34 +0100)
Some people make their lists subscriber-only for the only reason
that they want senders to confirm they can receive email.
For example, this is a weak form of anti-spam (senders which can not
receive mail and reply to it are filtered out).

However, this annoys one-time contributors which really just want to
post a random mail here and there.

To address this, add a new modemailsender option for sending moderation
emails back to senders instead of moderators. They can now then confirm
it themselves - less work for moderators!

Specifically, when the control/modemailsender file is present,
moderation emails are sent to the original sender instead of moderators.
Only affects moderated lists.

TUNABLES.md
src/mlmmj-process.c

index 539a3a4557aa4988f37a5fa75cc919062e7dcb1a..cbf9d2160e169e65edc7de5e97d6e41ec3f8ed0f 100644 (file)
@@ -130,6 +130,12 @@ entire content is used as value, it's marked "text".
    If this file is present, the poster (based on the envelope from) will
    get a mail when their post is being moderated.
 
+ * modemailsender              (boolean)
+
+   If this file is present, moderation emails for posts are sent to the
+   original sender instead of the moderators. Only affects moderated lists.
+   Has no effect on non-moderated lists.
+
  * digestinterval              (normal)
 
    This file specifies how many seconds will pass before the next digest is
index 7fdacd1372c3d862d41a03af4b6346246765fabd..0f41fcb2e7aa50583b72ed161093ffbbc6105f1a 100644 (file)
@@ -122,6 +122,7 @@ static void newmoderated(struct ml *ml, const char *mailfilename,
        const char *efromismod = NULL;
        const char *mailbasename = mybasename(mailfilename);
        int notifymod = 0;
+       int modemailsender = 0;
        struct mail mail;
 #if 0
        printf("mailfilename = [%s], mailbasename = [%s]\n", mailfilename,
@@ -143,7 +144,11 @@ static void newmoderated(struct ml *ml, const char *mailfilename,
        gen_addr_cookie(reject, ml, "reject-", mailbasename);
 
        gen_addr(from, ml, "owner");
-       xasprintf(&to, "%s-moderators@%s", ml->name, ml->fqdn);
+
+       modemailsender = statctrl(ml->ctrlfd, "modemailsender");
+
+       if(modemailsender) to = xstrdup(posteraddr);
+       else xasprintf(&to, "%s-moderators@%s", ml->name, ml->fqdn);
 
        txt = open_text(ml->fd, "moderate", "post",
                        modreason_strs[modreason], NULL, "moderation");
@@ -202,6 +207,18 @@ static void newmoderated(struct ml *ml, const char *mailfilename,
                fclose(mail.fp);
                exit(EXIT_SUCCESS);
        }
+
+       if(modemailsender) {
+               memset(&mail, 0, sizeof(mail));
+               mail.from = from;
+               mail.to = to;
+               mail.fp = fopen(queuefilename, "r");
+               if (send_single_mail(&mail, ml, false))
+                       unlink(queuefilename);
+               fclose(mail.fp);
+               exit(EXIT_SUCCESS);
+       }
+
        exec_or_die(mlmmjsend, "-l", "2", "-L", ml->dir, "-F", from,
            "-m", queuefilename, NULL);
 }