commit 69bfb4f36f0b25583d31dfdd9dc2c7932eabb4d2 from: witcher date: Mon Aug 15 14:00:13 2022 UTC Always append URL to body of E-Mail Closes: https://todo.sr.ht/~witcher/rss-email/7 commit - e8c5640f7c0c84e3a3da2f141895ba422f96924c commit + 69bfb4f36f0b25583d31dfdd9dc2c7932eabb4d2 blob - 9ea9a0498d0ccb417849f6b9114dacbb4590bf26 blob + 23cf3199ce6465637290ec3eaef1437312d61b0c --- src/main.rs +++ src/main.rs @@ -32,7 +32,6 @@ fn main() -> anyhow::Result<()> { let args = cli::Cli::build_app()?; let config = Config::new(args.config_path.unwrap())?; - dbg!(&config); let urls = BufReader::new( File::open(args.urls_path.as_ref().unwrap()).context(format!( @@ -73,9 +72,10 @@ fn send_posts(conn: &SqliteConnection, config: &Config for mut post in items { if !dry_run { let subject = post.title.unwrap_or_else(|| "No title found".to_string()); - // TODO: always append url instead - // https://todo.sr.ht/~witcher/rss-email/7 - let body = post.content.unwrap_or_else(|| post.url.unwrap()); + let body = match post.content { + Some(c) => c + "\n\n" + &post.url.unwrap(), + None => post.url.unwrap(), + }; send_email(config, subject, body, &mailer)?; } post.sent = true;