rss email digests over ssh because you're a cool kid herald.dunkirk.sh
go rss rss-reader ssh charm
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

chore: fix email encoding of emails

+16 -43
+13 -2
email/send.go
··· 4 4 "crypto/tls" 5 5 "fmt" 6 6 "mime" 7 + "mime/quotedprintable" 7 8 "net" 8 9 "net/smtp" 9 10 "strings" ··· 46 47 msg.WriteString(fmt.Sprintf("--%s\r\n", boundary)) 47 48 msg.WriteString("Content-Type: text/plain; charset=utf-8\r\n") 48 49 msg.WriteString("Content-Transfer-Encoding: quoted-printable\r\n\r\n") 49 - msg.WriteString(textBody) 50 + textQP := encodeQuotedPrintable(textBody) 51 + msg.WriteString(textQP) 50 52 msg.WriteString("\r\n") 51 53 52 54 msg.WriteString(fmt.Sprintf("--%s\r\n", boundary)) 53 55 msg.WriteString("Content-Type: text/html; charset=utf-8\r\n") 54 56 msg.WriteString("Content-Transfer-Encoding: quoted-printable\r\n\r\n") 55 - msg.WriteString(htmlBody) 57 + htmlQP := encodeQuotedPrintable(htmlBody) 58 + msg.WriteString(htmlQP) 56 59 msg.WriteString("\r\n") 57 60 58 61 msg.WriteString(fmt.Sprintf("--%s--\r\n", boundary)) ··· 67 70 } 68 71 69 72 return smtp.SendMail(addr, auth, m.cfg.From, []string{to}, []byte(msg.String())) 73 + } 74 + 75 + func encodeQuotedPrintable(s string) string { 76 + var buf strings.Builder 77 + w := quotedprintable.NewWriter(&buf) 78 + w.Write([]byte(s)) 79 + w.Close() 80 + return buf.String() 70 81 } 71 82 72 83 func (m *Mailer) sendWithTLS(addr string, auth smtp.Auth, to, msg string) error {
+3 -41
email/templates/digest.html
··· 4 4 <meta charset="utf-8"> 5 5 <meta name="viewport" content="width=device-width, initial-scale=1"> 6 6 <style> 7 - body { 8 - font-family: monospace; 9 - margin: 0; 10 - padding: 20px; 11 - line-height: 1.6; 12 - max-width: 600px; 13 - } 14 - a { 15 - word-wrap: break-word; 16 - } 17 - h1 { 18 - font-size: 16px; 19 - font-weight: bold; 20 - margin: 20px 0 5px 0; 21 - } 22 - h2 { 23 - font-size: 14px; 24 - font-weight: bold; 25 - margin: 15px 0 10px 0; 26 - } 27 7 img { 28 8 max-width: 100%; 29 9 height: auto; 30 10 } 31 - .feed-url { 32 - font-size: 14px; 33 - margin-bottom: 10px; 34 - } 35 11 .feeds { 36 12 max-width: 100%; 37 13 } 38 - .summary ul { 39 - margin: 5px 0; 40 - padding-left: 20px; 41 - } 42 - .summary li { 43 - margin-bottom: 5px; 44 - } 45 - .item { 46 - margin-bottom: 20px; 47 - } 48 - .item-content { 49 - margin-top: 10px; 50 - } 51 14 </style> 52 15 </head> 53 16 <body> 54 17 <div class="feeds"> 55 18 {{range .FeedGroups}} 56 19 <div style="margin-bottom: 10px;"> 57 - <h1><a href="{{.FeedURL}}">{{.FeedName}}</a></h1> 20 + <h1 style="margin-bottom: 3px;"><a href="{{.FeedURL}}">{{.FeedName}}</a></h1> 58 21 </div> 59 22 60 23 <div class="summary"> ··· 64 27 <li><a href="{{.Link}}">{{.Title}}</a></li> 65 28 </ul> 66 29 {{end}} 67 - <hr /> 68 30 </div> 69 31 70 32 {{if $.Inline}} 71 33 <div> 72 34 {{range .Items}} 73 - <div class="item"> 35 + <div> 74 36 <h1><a href="{{.Link}}">{{.Title}}</a></h1> 75 - <div class="item-content">{{.Content}}</div> 37 + <div>{{.Content}}</div> 76 38 </div> 77 39 <hr /> 78 40 {{end}}