mirror of
https://git.proxmox.com/git/proxmox
synced 2025-05-02 19:36:45 +00:00
fix #4162: sys: added auto-submitted
header to email body
`Auto-Submitted` is defined in the rfc 5436 [1] and describes how an automatic response (f.e. ooo replies, etc.) should behave on the emails. When using `Auto-Submitted: auto-generated` (or any value other than `none`) automatic replies won't be triggered. [1]: https://www.rfc-editor.org/rfc/rfc3834.html Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
This commit is contained in:
parent
359da67e9b
commit
bcdcb181ee
@ -7,6 +7,8 @@ use anyhow::{bail, Error};
|
|||||||
|
|
||||||
/// Sends multi-part mail with text and/or html to a list of recipients
|
/// Sends multi-part mail with text and/or html to a list of recipients
|
||||||
///
|
///
|
||||||
|
/// Includes the header `Auto-Submitted: auto-generated`, so that auto-replies
|
||||||
|
/// (i.e. OOO replies) won't trigger.
|
||||||
/// ``sendmail`` is used for sending the mail.
|
/// ``sendmail`` is used for sending the mail.
|
||||||
pub fn sendmail(
|
pub fn sendmail(
|
||||||
mailto: &[&str],
|
mailto: &[&str],
|
||||||
@ -69,6 +71,7 @@ pub fn sendmail(
|
|||||||
body.push_str("This is a multi-part message in MIME format.\n");
|
body.push_str("This is a multi-part message in MIME format.\n");
|
||||||
let _ = write!(body, "\n--{}\n", boundary);
|
let _ = write!(body, "\n--{}\n", boundary);
|
||||||
}
|
}
|
||||||
|
body.push_str("Auto-Submitted: auto-generated;\n");
|
||||||
if let Some(text) = text {
|
if let Some(text) = text {
|
||||||
body.push_str("Content-Type: text/plain;\n");
|
body.push_str("Content-Type: text/plain;\n");
|
||||||
body.push_str("\tcharset=\"UTF-8\"\n");
|
body.push_str("\tcharset=\"UTF-8\"\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user