1package message
2
3import (
4 "strings"
5)
6
7// NeedsQuotedPrintable returns whether text, with crlf-separated lines, should be
8// encoded with quoted-printable, based on line lengths and any bare carriage
9// return or bare newline. If not, it can be included as 7bit or 8bit encoding in a
10// new message.
11func NeedsQuotedPrintable(text string) bool {
12 // ../rfc/2045:1025
13 for _, line := range strings.Split(text, "\r\n") {
14 if len(line) > 78 || strings.Contains(line, "\r") || strings.Contains(line, "\n") {
15 return true
16 }
17 }
18 return false
19}
20