Skip to content

Commit

Permalink
Add X-RSS-Feed header to e-mail
Browse files Browse the repository at this point in the history
Planet feeds aggregate items from many disparate feed sources (i.e., the
X-RSS-URI point to different hosts). Adding the feed URL to the e-mail
header enables handling of all items from the planet feed
together (e.g., via a single procmail rule).

X-RSS-Feed was chosen as the header name because that is the same as
what rss2email uses.
  • Loading branch information
jamesd committed Feb 16, 2018
1 parent 62052bf commit 881a396
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mail.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type Email struct {
Date time.Time
Subject string
UserAgent string
FeedURL string
ItemURI string
Body string
}
Expand Down Expand Up @@ -57,6 +58,7 @@ func (email *Email) format() *gomail.Message {
if email.UserAgent != "" {
m.SetHeader("User-Agent", email.UserAgent)
}
m.SetHeader("X-RSS-Feed", email.FeedURL)
m.SetHeader("X-RSS-URI", email.ItemURI)
bodyPlain, err := html2text.FromString(email.Body)
if err != nil {
Expand All @@ -75,6 +77,7 @@ func createEmail(feedName string, feedTitle string, item *gofeed.Item, date time
email.Subject = item.Title
email.Date = date
email.setUserAgent(conf)
email.FeedURL = account.URI
email.ItemURI = item.Link
if item.Description == "" {
email.Body = item.Content
Expand Down

0 comments on commit 881a396

Please sign in to comment.