mirror of
https://blitiri.com.ar/repos/chasquid
synced 2026-01-07 17:47:14 +00:00
chasquid: Add "Received" email headers
This patch makes chasquid add "Received" email headers, after DATA completes and before queueing. We only use this for debugging purposes.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
package envelope
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"blitiri.com.ar/go/chasquid/internal/set"
|
||||
@@ -36,3 +37,14 @@ func DomainIn(addr string, locals *set.String) bool {
|
||||
|
||||
return locals.Has(domain)
|
||||
}
|
||||
|
||||
func AddHeader(data []byte, k, v string) []byte {
|
||||
// If the value contains newlines, indent them properly.
|
||||
if v[len(v)-1] == '\n' {
|
||||
v = v[:len(v)-1]
|
||||
}
|
||||
v = strings.Replace(v, "\n", "\n\t", -1)
|
||||
|
||||
header := []byte(fmt.Sprintf("%s: %s\n", k, v))
|
||||
return append(header, data...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user