tangled
alpha
login
or
join now
dunkirk.sh
/
herald
1
fork
atom
rss email digests over ssh because you're a cool kid
herald.dunkirk.sh
go
rss
rss-reader
ssh
charm
1
fork
atom
overview
issues
pulls
pipelines
chore: fix email deliverability issues
dunkirk.sh
1 month ago
d53c127d
7e06f55a
verified
This commit was signed with the committer's
known signature
.
dunkirk.sh
SSH Key Fingerprint:
SHA256:DqcG0RXYExE26KiWo3VxJnsxswN1QNfTBvB+bdSpk80=
+11
-2
1 changed file
expand all
collapse all
unified
split
email
send.go
+11
-2
email/send.go
···
2
2
3
3
import (
4
4
"bytes"
5
5
+
"crypto/rand"
5
6
"crypto/rsa"
6
7
"crypto/tls"
7
8
"crypto/x509"
9
9
+
"encoding/hex"
8
10
"encoding/pem"
9
11
"fmt"
10
12
"mime"
···
196
198
headers["Subject"] = mime.QEncoding.Encode("utf-8", subject)
197
199
headers["MIME-Version"] = "1.0"
198
200
headers["Content-Type"] = fmt.Sprintf("multipart/alternative; boundary=%q", boundary)
201
201
+
headers["Date"] = time.Now().Format(time.RFC1123Z)
202
202
+
headers["Message-ID"] = fmt.Sprintf("<%d.%s@%s>", time.Now().Unix(), generateMessageIDToken(), m.cfg.Host)
199
203
200
204
// RFC 2369 list headers
201
205
headers["List-Id"] = fmt.Sprintf("<herald.%s>", m.cfg.Host)
···
209
213
headers["List-Unsubscribe-Post"] = "List-Unsubscribe=One-Click"
210
214
}
211
215
212
212
-
// Bulk mail and auto-generated headers for better deliverability
216
216
+
// Bulk mail headers for better deliverability
213
217
headers["Precedence"] = "bulk"
214
214
-
headers["Auto-Submitted"] = "auto-generated"
215
218
headers["X-Mailer"] = "Herald"
216
219
217
220
var msg strings.Builder
···
257
260
}
258
261
259
262
return m.sendWithSTARTTLS(addr, auth, to, messageBytes)
263
263
+
}
264
264
+
265
265
+
func generateMessageIDToken() string {
266
266
+
b := make([]byte, 8)
267
267
+
_, _ = rand.Read(b)
268
268
+
return hex.EncodeToString(b)
260
269
}
261
270
262
271
func encodeQuotedPrintable(s string) string {