rss2email_lib/email/
mod.rs

1//! Constructs and sends emails from different providers.
2
3#[allow(clippy::use_self)]
4#[allow(clippy::module_name_repetitions)]
5pub mod email_provider;
6pub mod error;
7pub mod mail_cmd;
8pub mod resend;
9pub mod sendgrid;
10
11/// Holds all environment variables that are required
12/// by any email provider.
13#[derive(Debug)]
14pub struct EnvLoader {
15  pub(crate) api_key: Option<String>,
16}
17
18impl EnvLoader {
19  /// Creates a new `EnvLoader` by loading the
20  /// `API_KEY` environment variable.
21  pub(crate) fn new() -> Self {
22    Self {
23      api_key: std::env::var("API_KEY").ok(),
24    }
25  }
26}