proxmox-backup/src/tape/changer/email.rs
2020-12-30 17:16:57 +01:00

32 lines
675 B
Rust

use anyhow::Error;
use proxmox::tools::email::sendmail;
/// Send email to a person to request a manual media change
pub fn send_load_media_email(
drive: &str,
changer_id: &str,
to: &str,
) -> Result<(), Error> {
let subject = format!("Load Media '{}' request for drive '{}'", changer_id, drive);
let mut text = String::new();
text.push_str("Please insert the requested media into the backup drive.\n\n");
text.push_str(&format!("Drive: {}\n", drive));
text.push_str(&format!("Media: {}\n", changer_id));
sendmail(
&[to],
&subject,
Some(&text),
None,
None,
None,
)?;
Ok(())
}