zero-to-production/src/email_client.rs

27 lines
502 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,
2021-01-16 15:59:41 +00:00
html_content: &str,
text_content: &str,
2021-01-10 17:27:54 +00:00
) -> Result<(), String> {
todo!()
}
}