@@ 144,13 144,15 @@ func EnqueueStd(ctx context.Context, header mail.Header,
}
var (
- buf bytes.Buffer
- cleartext io.WriteCloser
+ buf bytes.Buffer
+ cleartext io.WriteCloser
+ inlineHeader mail.Header
)
if rcptKey != nil {
cleartext, err = prepareEncrypted(rcptKey, header, &buf, queue.entity)
}
+
// Fall back to unencrypted email if encryption did not work
// TODO should we add the error message to the email?
if rcptKey == nil || err != nil {
@@ 167,10 169,10 @@ func EnqueueStd(ctx context.Context, header mail.Header,
}
} else {
cleartext = nopWriteCloser{&buf}
+ inlineHeader = header
}
}
- var inlineHeader mail.Header
inlineHeader.SetContentType("text/plain", map[string]string{
"charset": "UTF-8",
"format": "flowed",