[pmg-devel] [PATCH pmg-api v2 1/6] config: add admin-mail-from key
Stoiko Ivanov
s.ivanov at proxmox.com
Tue Feb 25 16:01:57 CET 2025
To be used as From header for mails generated by the PMG stack.
Currently this is hardcoded to postmaster in a few places, and
Proxmox Mail Gateway <postmaster> in a few other 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.
The format is restricted by regex to printable ascii-characters for
now[1], as being more permissive later (even allowing all unicode
printables) is easy. The length restriction to 998 characters ist due
to a few SMTP-RFCs [2].
Envelope-from addresses for mail generated by will remain empty or
'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
[1] https://perldoc.perl.org/perlrecharclass
[2] https://www.rfc-editor.org/rfc/rfc5322#section-2.1.1
Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
src/PMG/Config.pm | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/PMG/Config.pm b/src/PMG/Config.pm
index 3170241..eabf81b 100644
--- a/src/PMG/Config.pm
+++ b/src/PMG/Config.pm
@@ -140,6 +140,12 @@ EODESC
enum => [qw(header envelope)],
default => 'envelope',
},
+ 'admin-mail-from' => {
+ description => "Text for 'From' header in admin mails and bounces.",
+ type => 'string',
+ pattern => '^\p{PosixPrint}{1,998}$',
+ default => 'Proxmox Mail Gateway <postmaster>',
+ },
};
}
@@ -159,6 +165,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