zero-to-production/src/email_client.rs

26 lines
469 B
Rust
Raw Normal View History

2021-01-10 17:27:54 +00:00
use crate::domain::SubscriberEmail;
2021-01-11 09:37:04 +00:00
use reqwest::Client;
2021-01-10 17:27:54 +00:00
2021-01-11 09:37:04 +00:00
pub struct EmailClient {
http_client: Client,
2021-01-16 15:11:17 +00:00
base_url: String,
2021-01-11 09:37:04 +00:00
}
2021-01-10 17:27:54 +00:00
impl EmailClient {
2021-01-16 15:11:17 +00:00
pub fn new(base_url: String) -> Self {
2021-01-11 09:37:04 +00:00
Self {
http_client: Client::new(),
2021-01-16 15:11:17 +00:00
base_url,
2021-01-11 09:37:04 +00:00
}
}
2021-01-10 17:27:54 +00:00
pub async fn send_email(
&self,
recipient: SubscriberEmail,
subject: &str,
content: &str,
) -> Result<(), String> {
todo!()
}
}