From e25a8c9ae70e5a310c1a82be55d0dbf58ba71250 Mon Sep 17 00:00:00 2001 From: Anders Betts Date: Mon, 21 Sep 2026 10:34:13 +0200 Subject: mail: honor smtp_reply_to; mention payroll in agent instructions --- src/commands.c | 3 +++ src/mail.c | 1 + src/smtp.c | 5 +++++ src/smtp.h | 1 + 4 files changed, 10 insertions(+) diff --git a/src/commands.c b/src/commands.c index 56e7010..5d5d7c1 100644 --- a/src/commands.c +++ b/src/commands.c @@ -123,6 +123,9 @@ static const char AGENT_INSTRUCTIONS[] = " next number, stores the PDF and posts the voucher in one transaction.\n" " `invoice.send` e-mails the stored PDF; it needs the org's SMTP settings\n" " and sends to the customer's address unless `to` overrides it.\n" + "- Payroll: `payroll.run_preview` then `payroll.run_post` per period;\n" + " `payroll.agi` returns the values for the manual arbetsgivardeklaration;\n" + " `payroll.payslip` renders and `payroll.payslip_mail` sends the payslip.\n" "\n" "## Discovery\n" "- `describe` lists every implemented command with permissions.\n" diff --git a/src/mail.c b/src/mail.c index 52d429c..ca35f6d 100644 --- a/src/mail.c +++ b/src/mail.c @@ -148,6 +148,7 @@ int mail_send_pdf(sqlite3 *db, int64_t org_id, const struct mail_message *m, sm.password = c.password ? c.password : ""; sm.from = c.from; sm.from_name = c.from_name; + sm.reply_to = c.reply_to && *c.reply_to ? c.reply_to : NULL; sm.to = m->to; sm.subject = m->subject; sm.body = m->body; diff --git a/src/smtp.c b/src/smtp.c index ed70519..6a90424 100644 --- a/src/smtp.c +++ b/src/smtp.c @@ -751,6 +751,11 @@ static int build_message(const struct smtp_message *m, const char *from, } buf_appendf(out, "<%s>\r\n", from); buf_appendf(out, "To: <%s>\r\n", to); + if (m->reply_to && m->reply_to[0]) { + char *rt = sanitize_dup(m->reply_to); + buf_appendf(out, "Reply-To: <%s>\r\n", rt); + free(rt); + } char *subject = sanitize_dup(m->subject ? m->subject : ""); buf_append_str(out, "Subject: "); diff --git a/src/smtp.h b/src/smtp.h index a6c4a34..0c1924a 100644 --- a/src/smtp.h +++ b/src/smtp.h @@ -11,6 +11,7 @@ struct smtp_message { const char *password; const char *from; /* envelope + From address */ const char *from_name; /* display name, may be NULL */ + const char *reply_to; /* Reply-To address, may be NULL */ const char *to; const char *subject; const char *body; /* UTF-8 text body */ -- cgit v1.3