From: Lukas Wagner <l.wagner@proxmox.com>
To: pve-devel@lists.proxmox.com, pbs-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH proxmox 1/2] notify: warn if a user referred to by 'mailto-user' does not have an email address
Date: Tue, 22 Jul 2025 14:02:20 +0200 [thread overview]
Message-ID: <20250722120305.326096-1-l.wagner@proxmox.com> (raw)
Showing warnings for any email address that could not be looked up seems
appropriate. If the final recipient list is completely empty (as in,
attempting to send an email with no recipients), an error is still
raised.
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---
proxmox-notify/src/endpoints/common/mail.rs | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/proxmox-notify/src/endpoints/common/mail.rs b/proxmox-notify/src/endpoints/common/mail.rs
index b1c48236..7a2de59f 100644
--- a/proxmox-notify/src/endpoints/common/mail.rs
+++ b/proxmox-notify/src/endpoints/common/mail.rs
@@ -10,8 +10,14 @@ pub(crate) fn get_recipients(email_addrs: &[String], users: &[String]) -> HashSe
}
for user in users {
- if let Some(addr) = context::context().lookup_email_for_user(user) {
- recipients.insert(addr);
+ match context::context().lookup_email_for_user(user) {
+ Some(address) => {
+ recipients.insert(address);
+ }
+ None => tracing::warn!(
+ "'{user}' does not have a configured email address in the user configuration - \
+ not sending an email to this user"
+ ),
}
}
recipients
--
2.47.2
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next reply other threads:[~2025-07-22 12:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-22 12:02 Lukas Wagner [this message]
2025-07-22 12:02 ` [pve-devel] [PATCH proxmox 2/2] notify: sendmail: smtp: list email recipients in stable order Lukas Wagner
2025-07-23 18:54 ` [pve-devel] applied: [PATCH proxmox 1/2] notify: warn if a user referred to by 'mailto-user' does not have an email address Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250722120305.326096-1-l.wagner@proxmox.com \
--to=l.wagner@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox