public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH proxmox 1/2] notify: warn if a user referred to by 'mailto-user' does not have an email address
@ 2025-07-22 12:02 Lukas Wagner
  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
  0 siblings, 2 replies; 3+ messages in thread
From: Lukas Wagner @ 2025-07-22 12:02 UTC (permalink / raw)
  To: pve-devel, pbs-devel

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-23 18:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-22 12:02 [pve-devel] [PATCH proxmox 1/2] notify: warn if a user referred to by 'mailto-user' does not have an email address Lukas Wagner
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal