mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 19:44:34 +03:00
add more details to x-mox-reason message header added during delivery, for understanding why a message is accepted/rejected
we add various information while analysing an incoming message. like dkim/spf/ip reputation. and content-based junk filter threshold/result and ham/spam words used. for issue #179 by Fell and #157 by mattfbacon
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package message
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
@ -39,12 +40,20 @@ func (w *HeaderWriter) Add(separator string, texts ...string) {
|
||||
}
|
||||
}
|
||||
|
||||
// AddWrap adds data, folding anywhere in the buffer. E.g. for base64 data.
|
||||
func (w *HeaderWriter) AddWrap(buf []byte) {
|
||||
// AddWrap adds data. If text is set, wrapping happens at space/tab, otherwise
|
||||
// anywhere in the buffer (e.g. for base64 data).
|
||||
func (w *HeaderWriter) AddWrap(buf []byte, text bool) {
|
||||
for len(buf) > 0 {
|
||||
line := buf
|
||||
n := 78 - w.lineLen
|
||||
if len(buf) > n {
|
||||
if text {
|
||||
if i := bytes.LastIndexAny(buf[:n], " \t"); i > 0 {
|
||||
n = i
|
||||
} else if i = bytes.IndexAny(buf, " \t"); i > 0 {
|
||||
n = i
|
||||
}
|
||||
}
|
||||
line, buf = buf[:n], buf[n:]
|
||||
} else {
|
||||
buf = nil
|
||||
|
Reference in New Issue
Block a user