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