BuildForwardSubject prefixes "Fwd: " unless the subject already starts with Fwd:, Fw:, or Re:. The dedup avoids stacking on chains. Empty inputs produce "Fwd: (no subject)" so the recipient still sees the message is a forward.
(orig string)
| 182 | // inputs produce "Fwd: (no subject)" so the recipient still sees the |
| 183 | // message is a forward. |
| 184 | func BuildForwardSubject(orig string) string { |
| 185 | trimmed := strings.TrimSpace(orig) |
| 186 | if trimmed == "" { |
| 187 | return "Fwd: (no subject)" |
| 188 | } |
| 189 | lower := strings.ToLower(trimmed) |
| 190 | if strings.HasPrefix(lower, "fwd:") || strings.HasPrefix(lower, "fw:") { |
| 191 | return trimmed |
| 192 | } |
| 193 | return "Fwd: " + trimmed |
| 194 | } |
| 195 | |
| 196 | // BuildForwardBody composes the text/plain body of a forward: the |
| 197 | // caller's optional comment, a Gmail-style divider, the original headers |
no outgoing calls