public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Lukas Wagner <l.wagner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH proxmox 3/6] notify: sendmail: make mailfrom and author non-optional
Date: Mon, 24 Jun 2024 14:31:31 +0200	[thread overview]
Message-ID: <20240624123134.321417-3-l.wagner@proxmox.com> (raw)
In-Reply-To: <20240624123134.321417-1-l.wagner@proxmox.com>

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---
 proxmox-notify/src/endpoints/sendmail.rs | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/proxmox-notify/src/endpoints/sendmail.rs b/proxmox-notify/src/endpoints/sendmail.rs
index e75902fc..0f7a61b0 100644
--- a/proxmox-notify/src/endpoints/sendmail.rs
+++ b/proxmox-notify/src/endpoints/sendmail.rs
@@ -141,8 +141,8 @@ impl Endpoint for SendmailEndpoint {
                     &subject,
                     Some(&text_part),
                     Some(&html_part),
-                    Some(&mailfrom),
-                    Some(&author),
+                    &mailfrom,
+                    &author,
                 )
                 .map_err(|err| Error::NotifyFailed(self.config.name.clone(), err.into()))
             }
@@ -174,8 +174,8 @@ fn sendmail(
     subject: &str,
     text: Option<&str>,
     html: Option<&str>,
-    mailfrom: Option<&str>,
-    author: Option<&str>,
+    mailfrom: &str,
+    author: &str,
 ) -> Result<(), Error> {
     use std::fmt::Write as _;
 
@@ -184,9 +184,7 @@ fn sendmail(
             "At least one recipient has to be specified!".into(),
         ));
     }
-    let mailfrom = mailfrom.unwrap_or("root");
     let recipients = mailto.join(",");
-    let author = author.unwrap_or("Proxmox Backup Server");
 
     let now = proxmox_time::epoch_i64();
 
@@ -339,8 +337,8 @@ mod test {
             "Subject2",
             None,
             Some("<b>HTML</b>"),
-            None,
-            Some("test1"),
+            "root",
+            "Proxmox",
         );
         assert!(result.is_err());
     }
-- 
2.39.2



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


  parent reply	other threads:[~2024-06-24 12:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-24 12:31 [pve-devel] [PATCH proxmox 1/6] notify: copy sendmail/forward fn's from proxmox_sys Lukas Wagner
2024-06-24 12:31 ` [pve-devel] [PATCH proxmox 2/6] sys: mark email fn's as deprecated Lukas Wagner
2024-06-24 12:31 ` Lukas Wagner [this message]
2024-06-24 12:31 ` [pve-devel] [PATCH proxmox 4/6] notify: move mail formatting to separate function Lukas Wagner
2024-06-24 12:31 ` [pve-devel] [PATCH proxmox 5/6] notify: sendmail: always send multi-part message Lukas Wagner
2024-06-24 12:31 ` [pve-devel] [PATCH proxmox 6/6] notify: sendmail: code style improvements Lukas Wagner
2024-07-12  8:56 ` [pve-devel] partially-applied: [PATCH proxmox 1/6] notify: copy sendmail/forward fn's from proxmox_sys Wolfgang Bumiller

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=20240624123134.321417-3-l.wagner@proxmox.com \
    --to=l.wagner@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal