[pve-devel] [PATCH proxmox 1/2] notify: warn if a user referred to by 'mailto-user' does not have an email address

Lukas Wagner l.wagner at proxmox.com
Tue Jul 22 14:02:20 CEST 2025


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 at 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





More information about the pve-devel mailing list