repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

commit
c9c0f38
parent
c580ee6
author
Eric Bower
date
2022-12-22 04:07:59 +0000 UTC
chore(feeds): change subject of email based on post title
1 files changed,  +3, -3
M feeds/cron.go
+3, -3
 1@@ -121,7 +121,8 @@ func (f *Fetcher) RunPost(user *db.User, post *db.Post) error {
 2 		return err
 3 	}
 4 
 5-	err = f.SendEmail(user.Name, parsed.Email, msgBody)
 6+	subject := fmt.Sprintf("%s feed digest", post.Title)
 7+	err = f.SendEmail(user.Name, parsed.Email, subject, msgBody)
 8 	if err != nil {
 9 		return err
10 	}
11@@ -307,13 +308,12 @@ func (f *Fetcher) FetchAll(urls []string, lastDigest *time.Time) (*MsgBody, erro
12 	}, nil
13 }
14 
15-func (f *Fetcher) SendEmail(username, email string, msg *MsgBody) error {
16+func (f *Fetcher) SendEmail(username, email string, subject string, msg *MsgBody) error {
17 	if email == "" {
18 		return fmt.Errorf("(%s) does not have an email associated with their feed post", username)
19 	}
20 
21 	from := mail.NewEmail("team pico", f.cfg.Email)
22-	subject := "feeds.sh daily digest"
23 	to := mail.NewEmail(username, email)
24 
25 	// f.cfg.Logger.Infof("message body (%s)", plainTextContent)