From: Baptiste Daroussin Date: Thu, 16 Feb 2023 15:01:02 +0000 (+0100) Subject: mlmmj-maintd: sendqueue directly instead of calling mlmmj-send X-Git-Tag: RELEASE_1_4_0b1~120 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0c686e3a764b2bd511c77cd3d14ce13b8dc9f8eb;p=thirdparty%2Fmlmmj.git mlmmj-maintd: sendqueue directly instead of calling mlmmj-send --- diff --git a/src/mlmmj-maintd.c b/src/mlmmj-maintd.c index 5ce9db02..9a3f0f3b 100644 --- a/src/mlmmj-maintd.c +++ b/src/mlmmj-maintd.c @@ -45,6 +45,7 @@ #include "send_digest.h" #include "log_oper.h" #include "utils.h" +#include "send_mail.h" #define log(...) dprintf(logfd, __VA_ARGS__); #define opendirat(_dirfd, _fd, _dirent, _path) \ @@ -145,7 +146,7 @@ clean_unsubconf(int dfd, int logfd) } static bool -resend_queue(struct ml *ml, const char *mlmmjsend, int logfd) +resend_queue(struct ml *ml, int logfd) { DIR *queuedir; struct dirent *dp; @@ -155,6 +156,7 @@ resend_queue(struct ml *ml, const char *mlmmjsend, int logfd) int err = 0, qfd; time_t t, bouncelife; bool ret = true; + struct mail mail; opendirat(ml->fd, qfd, queuedir, "queue"); @@ -237,13 +239,13 @@ resend_queue(struct ml *ml, const char *mlmmjsend, int logfd) continue; } - if(repto) - exec_and_wait(mlmmjsend, "-l", "1", "-L", ml->dir, "-m", - mailname, "-F", from, "-T", to, "-R", repto, "-a", - NULL); - else - exec_and_wait(mlmmjsend, "-l", "1", "-L", ml->dir, "-m", - mailname, "-F", from, "-T", to, "-a", NULL); + memset(&mail, 0, sizeof(mail)); + mail.to = to; + mail.from = from; + mail.replyto = repto; + mail.fp = fopen(mailname, "r"); + send_single_mail(&mail, ml, false); + fclose(mail.fp); } closedir(queuedir); @@ -685,7 +687,7 @@ void do_maintenance(struct ml *ml, const char *mlmmjsend, const char *mlmmjbounc "confirmations, mails, see %s", MAINTD_LOGFILE); log("resend_queue\n"); - if (!resend_queue(ml, mlmmjsend, logfd)) + if (!resend_queue(ml, logfd)) log_err("An error occured while resending queued mails, see %s", MAINTD_LOGFILE);