From: Michael S. Tsirkin Date: Sun, 24 Aug 2025 17:45:28 +0000 (-0400) Subject: add modemailsender option for sender moderation X-Git-Tag: RELEASE_1_7_0~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a6cea8f6d10760cdbf020e054ad0dc3f726c81b9;p=thirdparty%2Fmlmmj.git add modemailsender option for sender moderation 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. --- diff --git a/TUNABLES.md b/TUNABLES.md index 539a3a45..cbf9d216 100644 --- a/TUNABLES.md +++ b/TUNABLES.md @@ -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 diff --git a/src/mlmmj-process.c b/src/mlmmj-process.c index 7fdacd13..0f41fcb2 100644 --- a/src/mlmmj-process.c +++ b/src/mlmmj-process.c @@ -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); }