all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-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
  0 siblings, 0 replies; 6+ 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



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-22 12:02 [pbs-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] " Lukas Wagner
2025-07-22 12:02 ` [pbs-devel] [PATCH proxmox 2/2] notify: sendmail: smtp: list email recipients in stable order Lukas Wagner
2025-07-22 12:02   ` [pve-devel] " Lukas Wagner
2025-07-23 18:54 ` [pbs-devel] applied: [pve-devel] [PATCH proxmox 1/2] notify: warn if a user referred to by 'mailto-user' does not have an email address Thomas Lamprecht
2025-07-23 18:54   ` [pve-devel] applied: " Thomas Lamprecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal