simplify email title and body to be just stats #62

Merged
eleith merged 1 commits from gemini/feature/email-stats-summary into main 2025-12-17 23:34:38 +00:00
3 changed files with 16 additions and 18 deletions

No files matched your search

+2 -2
View File
@@ -38,8 +38,8 @@ func (s *EmailServiceImpl) Send(smtpConfig config.ConfigSmtp, digestConfig confi
return err
}
subject := fmt.Sprintf("Your Miniflux Digest for %s", data.GeneratedDate.Format("January 2, 2006"))
overviewURL := fmt.Sprintf("%s/archive/%s/index.html", digestConfig.Host, data.GeneratedDate.Format("2006-01-02"))
subject := fmt.Sprintf("%s - %s", digestConfig.Title, data.GeneratedDate.Format("January 2, 2006"))
overviewURL := fmt.Sprintf("%s/archive/%s/%s/index.html", digestConfig.Host, data.DigestSlug, data.GeneratedDate.Format("2006-01-02"))
message.Subject(subject)
+12 -13
View File
@@ -1,19 +1,18 @@
Your digest for {{ .GeneratedDate.Format "Jan 2, 2006" }} is ready with {{.TotalEntries}} entries from {{.TotalFeeds}} feeds.
----------------------------------------
{{ if gt .TotalEntries 0 -}}
Totals: {{.TotalEntries}} entries from {{.TotalFeeds}} feeds.
Breakdown by Topic:
{{range .PrimaryGroups -}}
{{ .Title }}
{{ if .Summary -}}
{{ .Summary }}
{{- else -}}
(no summary)
{{- end }}
{{end}}----------------------------------------
{{ if gt .TotalEntries 0 -}}
- {{ .Title }}: {{ .TotalEntries }} entries
{{end -}}
{{end}}
{{ if .URL -}}
The individual HTML digests for each group are attached, or you can view the full digest online: {{ .URL }}
View the full digest online: {{ .URL }}
{{- end }}
(Individual group HTML files are attached)
{{- else -}}
The individual HTML digests for each group are attached.
No new entries were found for this digest period.
{{- end }}
+2 -3
View File
@@ -224,13 +224,12 @@ func generateAndArchiveHTML(cfg *config.Config, digestIndex int, minifluxFlag bo
return overviewFile, groupedEntryFiles, overviewURL, data
}
func handleEmail(cfg *config.Config, overviewFile *os.File, groupedEntryFiles []*os.File, data *models.OverviewTemplateData) {
func handleEmail(cfg *config.Config, digestConfig config.ConfigDigest, overviewFile *os.File, groupedEntryFiles []*os.File, data *models.OverviewTemplateData) {
log.Println("main: Email flag is true, sending email...")
emailSvc := &email.EmailServiceImpl{
EmailTemplate: templates.EmailTemplate,
}
digestConfig := cfg.Digests[0]
if err := emailSvc.Send(cfg.Smtp, digestConfig, overviewFile, groupedEntryFiles, data); err != nil {
log.Fatalf("Failed to send email: %v", err)
}
@@ -268,7 +267,7 @@ func main() {
if emailFlag {
for digestIndex := range numDigest {
overviewFile, groupedEntryFiles, _, data := generateAndArchiveHTML(cfg, digestIndex, minifluxFlag)
handleEmail(cfg, overviewFile, groupedEntryFiles, data)
handleEmail(cfg, cfg.Digests[digestIndex], overviewFile, groupedEntryFiles, data)
}
} else if htmlFlag {
for digestIndex := range numDigest {