[pve-devel] [PATCH proxmox 3/6] notify: sendmail: make mailfrom and author non-optional
Lukas Wagner
l.wagner at proxmox.com
Mon Jun 24 14:31:31 CEST 2024
Signed-off-by: Lukas Wagner <l.wagner at 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
More information about the pve-devel
mailing list