notify: sendmail: make mailfrom and author non-optional
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
This commit is contained in:
parent
6fed7301ea
commit
888ec2efe7
@ -142,8 +142,8 @@ impl Endpoint for SendmailEndpoint {
|
|||||||
&subject,
|
&subject,
|
||||||
Some(&text_part),
|
Some(&text_part),
|
||||||
Some(&html_part),
|
Some(&html_part),
|
||||||
Some(&mailfrom),
|
&mailfrom,
|
||||||
Some(&author),
|
&author,
|
||||||
)
|
)
|
||||||
.map_err(|err| Error::NotifyFailed(self.config.name.clone(), err.into()))
|
.map_err(|err| Error::NotifyFailed(self.config.name.clone(), err.into()))
|
||||||
}
|
}
|
||||||
@ -175,8 +175,8 @@ fn sendmail(
|
|||||||
subject: &str,
|
subject: &str,
|
||||||
text: Option<&str>,
|
text: Option<&str>,
|
||||||
html: Option<&str>,
|
html: Option<&str>,
|
||||||
mailfrom: Option<&str>,
|
mailfrom: &str,
|
||||||
author: Option<&str>,
|
author: &str,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
use std::fmt::Write as _;
|
use std::fmt::Write as _;
|
||||||
|
|
||||||
@ -185,9 +185,7 @@ fn sendmail(
|
|||||||
"At least one recipient has to be specified!".into(),
|
"At least one recipient has to be specified!".into(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
let mailfrom = mailfrom.unwrap_or("root");
|
|
||||||
let recipients = mailto.join(",");
|
let recipients = mailto.join(",");
|
||||||
let author = author.unwrap_or("Proxmox Backup Server");
|
|
||||||
|
|
||||||
let now = proxmox_time::epoch_i64();
|
let now = proxmox_time::epoch_i64();
|
||||||
|
|
||||||
@ -340,8 +338,8 @@ mod test {
|
|||||||
"Subject2",
|
"Subject2",
|
||||||
None,
|
None,
|
||||||
Some("<b>HTML</b>"),
|
Some("<b>HTML</b>"),
|
||||||
None,
|
"root",
|
||||||
Some("test1"),
|
"Proxmox",
|
||||||
);
|
);
|
||||||
assert!(result.is_err());
|
assert!(result.is_err());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user