diff --git a/meli.conf.5 b/meli.conf.5 index b2c35c89..da764451 100644 --- a/meli.conf.5 +++ b/meli.conf.5 @@ -227,6 +227,10 @@ command to launch editor. Can have arguments. Draft filename is given as the las (optional) embed editor within meli .\" default value .Pq Em false +.It Cm format_flowed Ar boolean +(optional) set format=flowed [RFC367] in text/plain attachments. +.\" default value +.Pq Em true .El .Sh SHORTCUTS Shortcuts can take the following values: diff --git a/ui/src/components/mail/compose.rs b/ui/src/components/mail/compose.rs index 3792c729..71092bb6 100644 --- a/ui/src/components/mail/compose.rs +++ b/ui/src/components/mail/compose.rs @@ -1202,6 +1202,7 @@ pub fn send_draft( use std::process::{Command, Stdio}; let mut failure = true; let settings = &context.settings; + let format_flowed = settings.composing.format_flowed; let parts = split_command!(settings.composing.mailer_cmd); let (cmd, args) = (parts[0], &parts[1..]); let mut msmtp = Command::new(cmd) @@ -1213,8 +1214,18 @@ pub fn send_draft( { let stdin = msmtp.stdin.as_mut().expect("failed to open stdin"); if sign_mail.is_true() { + let mut content_type = ContentType::default(); + if format_flowed { + if let ContentType::Text { + ref mut parameters, .. + } = content_type + { + parameters.push((b"format".to_vec(), b"flowed".to_vec())); + } + } + let mut body: AttachmentBuilder = Attachment::new( - Default::default(), + content_type, Default::default(), std::mem::replace(&mut draft.body, String::new()).into_bytes(), ) diff --git a/ui/src/conf/composing.rs b/ui/src/conf/composing.rs index 736641ee..8e5dac49 100644 --- a/ui/src/conf/composing.rs +++ b/ui/src/conf/composing.rs @@ -18,7 +18,7 @@ * You should have received a copy of the GNU General Public License * along with meli. If not, see . */ -use super::default_vals::{false_val, none}; +use super::default_vals::{false_val, none, true_val}; /// Settings for writing and sending new e-mail #[derive(Debug, Serialize, Deserialize, Clone)] @@ -32,6 +32,10 @@ pub struct ComposingSettings { /// Embed editor (for terminal interfaces) instead of forking and waiting. #[serde(default = "false_val")] pub embed: bool, + /// Set "format=flowed" in plain text attachments. + /// Default: true + #[serde(default = "true_val")] + pub format_flowed: bool, } impl Default for ComposingSettings { @@ -40,6 +44,7 @@ impl Default for ComposingSettings { mailer_cmd: String::new(), editor_cmd: None, embed: false, + format_flowed: true, } } }