aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--config/aerc.conf9
-rw-r--r--config/compose.go1
-rw-r--r--doc/aerc-config.5.scd9
-rw-r--r--widgets/compose.go21
5 files changed, 33 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6742655c..db160094 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- New column-based message list format with `index-columns`.
- Add a `msglist_answered` style for answered messages.
+- Compose `Format=Flowed` messages with `format-flowed=true` in `aerc.conf`.
### Changed
diff --git a/config/aerc.conf b/config/aerc.conf
index b09a7ab7..5f58ceb2 100644
--- a/config/aerc.conf
+++ b/config/aerc.conf
@@ -386,6 +386,15 @@
#
#no-attachment-warning=
+#
+# When set, aerc will generate "format=flowed" bodies with a content type of
+# "text/plain; format=flowed" as described in RFC3676. This format is easier to
+# handle for some mailing software, and generally just looks like ordinary
+# text. To actually make use of this format's features, you'll need support in
+# your editor.
+#
+#format-flowed=false
+
[multipart-converters]
#
# Converters allow to generate multipart/alternative messages by converting the
diff --git a/config/compose.go b/config/compose.go
index 80d93204..14a3087b 100644
--- a/config/compose.go
+++ b/config/compose.go
@@ -15,6 +15,7 @@ type ComposeConfig struct {
ReplyToSelf bool `ini:"reply-to-self"`
NoAttachmentWarning *regexp.Regexp `ini:"-"`
FilePickerCmd string `ini:"file-picker-cmd"`
+ FormatFlowed bool `ini:"format-flowed"`
}
func defaultComposeConfig() *ComposeConfig {
diff --git a/doc/aerc-config.5.scd b/doc/aerc-config.5.scd
index 22c3a40a..74481b10 100644
--- a/doc/aerc-config.5.scd
+++ b/doc/aerc-config.5.scd
@@ -563,6 +563,15 @@ These options are configured in the *[compose]* section of _aerc.conf_.
Example:
*no-attachment-warning* = _^[^>]\*attach(ed|ment)_
+*format-flowed* = _true_|_false_
+ When set, aerc will generate _Format=Flowed_ bodies with a content type
+ of _"text/plain; Format=Flowed"_ as described in RFC3676. This format is
+ easier to handle for some mailing software, and generally just looks
+ like ordinary text. To actually make use of this format's features,
+ you'll need support in your editor.
+
+ Default: _false_
+
# MULTIPART CONVERTERS
Converters allow generating _multipart/alternative_ messages by converting the
diff --git a/widgets/compose.go b/widgets/compose.go
index 3ae41989..5795ccba 100644
--- a/widgets/compose.go
+++ b/widgets/compose.go
@@ -825,20 +825,20 @@ func (c *Composer) ShouldWarnAttachment() (bool, error) {
}
func writeMsgImpl(c *Composer, header *mail.Header, writer io.Writer) error {
+ mimeParams := map[string]string{"Charset": "UTF-8"}
+ if config.Compose.FormatFlowed {
+ mimeParams["Format"] = "Flowed"
+ }
if len(c.attachments) == 0 && len(c.textParts) == 0 {
// no attachments
- return writeInlineBody(header, c.email, writer)
+ return writeInlineBody(header, c.email, writer, mimeParams)
} else {
// with attachments
w, err := mail.CreateWriter(writer, *header)
if err != nil {
return errors.Wrap(err, "CreateWriter")
}
- newPart, err := lib.NewPart(
- "text/plain",
- map[string]string{"Charset": "UTF-8"},
- c.email,
- )
+ newPart, err := lib.NewPart("text/plain", mimeParams, c.email)
if err != nil {
return err
}
@@ -856,8 +856,13 @@ func writeMsgImpl(c *Composer, header *mail.Header, writer io.Writer) error {
return nil
}
-func writeInlineBody(header *mail.Header, body io.Reader, writer io.Writer) error {
- header.SetContentType("text/plain", map[string]string{"charset": "UTF-8"})
+func writeInlineBody(
+ header *mail.Header,
+ body io.Reader,
+ writer io.Writer,
+ mimeParams map[string]string,
+) error {
+ header.SetContentType("text/plain", mimeParams)
w, err := mail.CreateSingleInlineWriter(writer, *header)
if err != nil {
return errors.Wrap(err, "CreateSingleInlineWriter")