[pmg-devel] [PATCH pmg-api 1/7] config: add admin-mail-from key

Stoiko Ivanov s.ivanov at proxmox.com
Tue Feb 25 00:24:46 CET 2025


To be used as From header address for mails generated by the PMG
stack. Currently this is hardcoded to postmaster in a few places.

While PMG generates mails as the mail-system and postmaster is a
good choice for such mails, users sometimes wish to customize the
e-mail shown e.g. in the backup-notification and the daily admin
report.

The set value will be used in the header only, following the similar
setting 'mailfrom' in the 'spamquar' setting.
I decided against reusing the existing setting, as it's specifically
tied to a category.

PMG will as keep sending most mails with an empty envelope-from or
with 'postmaster'.

This is a first step towards DKIM signing those mails.

Users will have to opt-in to it and use a email with domain-part to
get DKIM signing.

I decided against changing the current behavior of using 'postmaster'
without domain, as this makes postfix complete the address with
'@$myorigin.$mydomain'[0], and I've seen quite a few installations
which set those settings in their main.cf.in templates.

[0] https://www.postfix.org/postconf.5.html#internal_mail_filter_classes

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 src/PMG/Config.pm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/PMG/Config.pm b/src/PMG/Config.pm
index 3170241..c583cc6 100644
--- a/src/PMG/Config.pm
+++ b/src/PMG/Config.pm
@@ -140,6 +140,11 @@ EODESC
 	    enum => [qw(header envelope)],
 	    default => 'envelope',
 	},
+	'admin-mail-from' => {
+	    description => "Text for 'From' header in admin mails and bounces.",
+	    type => 'string',
+	    default => 'postmaster',
+	},
     };
 }
 
@@ -159,6 +164,7 @@ sub options {
 	dkim_sign_all_mail => { optional => 1 },
 	dkim_selector => { optional => 1 },
 	'dkim-use-domain' => { optional => 1 },
+	'admin-mail-from' => { optional => 1 },
     };
 }
 
-- 
2.39.5





More information about the pmg-devel mailing list