commit e8c5640f7c0c84e3a3da2f141895ba422f96924c from: witcher date: Mon Aug 15 13:51:13 2022 UTC TLS: Let lib handle TLS settings This seems to work for Migadu as an SMTP server, but hasn't been tested with other SMTP servers (e.g. without any TLS at all). Closes: https://todo.sr.ht/~witcher/rss-email/8 commit - ccb62d531454eb4b79b334d3d72be07aa85f4101 commit + e8c5640f7c0c84e3a3da2f141895ba422f96924c blob - 98c81d0675870c295c157e7fb817f9132755c138 blob + 35075ef09abae29483866db27c732082673f405a --- src/mail.rs +++ src/mail.rs @@ -3,7 +3,6 @@ use lettre::{ message::Message, transport::smtp::{ authentication::Credentials, - client::{Tls, TlsParameters}, SmtpTransport, }, Transport, @@ -15,14 +14,7 @@ pub fn get_mailer(config: &Config) -> anyhow::Result anyhow::Result<()> { let results = posts .filter(sent.eq(false)) .order(pub_date.desc()) - .limit(5) .load::(&conn)?; - send_posts(&config, results, args.dry_run)?; + send_posts(&conn, &config, results, args.dry_run)?; Ok(()) } -fn send_posts(config: &Config, items: Vec, dry_run: bool) -> anyhow::Result<()> { +fn send_posts(conn: &SqliteConnection, config: &Config, items: Vec, dry_run: bool) -> anyhow::Result<()> { let mailer = get_mailer(config)?; for mut post in items { if !dry_run { @@ -80,8 +79,8 @@ fn send_posts(config: &Config, items: Vec