commit - b08bce93dcb5f26e36b8af60ef043a410e433d37
commit + d130dc56b6ad70892956ea124cabc4a10d41d144
blob - 214c604cd3da20b5ca6342c98f0c7f096d7eedd6
blob + 624cf395311b55505b2460b0a3d3c080c634a919
--- config.example.toml
+++ config.example.toml
+[mail]
to = "receiver <rcv@test.de>"
from = "sender <snd@test.de>"
blob - 3ea64a00623a1f692b97061969e7e90f4a409312
blob + 2cf4f0a840923f1242b4b45ae1c0648da56eca3c
--- docs/rss-email.5.scd
+++ docs/rss-email.5.scd
The configuration file contains all necessary configuration to
send an email.
-## Global section
+## Mail section
-The global section of the configuration file defines 2 attributes:
+The mail section of the configuration file defines 2 attributes:
- *from*: String
- *to*: String
blob - 6b8db99b6e78ee8aaff812259d9c765e2fc177d5
blob + cfa54e844a67c1449635bd5b3e23cb5697a6cc2f
--- src/config.rs
+++ src/config.rs
#[derive(Debug, Deserialize)]
pub struct Config {
+ pub(crate) mail: Mail,
+ pub(crate) smtp: SmtpConfig,
+}
+
+#[derive(Debug, Deserialize)]
+pub struct Mail {
pub(crate) to: String,
pub(crate) from: String,
- pub(crate) smtp: SmtpConfig,
}
#[derive(Debug, Deserialize)]
blob - fe2d45e09b585c160662abb7768776c38f69bf9a
blob + ce2e1334fdc800f008887b2094e3add8da6622ff
--- src/mail.rs
+++ src/mail.rs
config: &Config,
mailer: &AsyncSmtpTransport<Tokio1Executor>,
) -> anyhow::Result<()> {
- trace!("Sending to {}: {}", config.to, &self.subject);
+ trace!("Sending to {}: {}", config.mail.to, &self.subject);
let email = Message::builder()
- .from(config.from.parse()?)
- .to(config.to.parse()?)
+ .from(config.mail.from.parse()?)
+ .to(config.mail.to.parse()?)
.subject(self.subject)
.body(self.body)?;