I want to send a message containing an email in a template, but I don't want to call SmtpClient Builder::new every time for each email.
Maybe you know how to make it more elastic?
let template = format!("Dear {email}, You are now change your email.");
let emails = vec![...];
let message = MessageBuilder::new()
.from((username, email))
.to(emails)
.subject("Subject")
.text_body(&template);
SmtpClientBuilder::new(self.hostname.clone(), self.port)
.implicit_tls(false)
.credentials((self.from.clone(), self.password.clone()))
.connect()
.await
.expect("connect to send email")
.send(message)
.await
.unwrap();
As a solution maybe need implement .send_many(message) where we can create message for every individual user?
I want to send a message containing an email in a template, but I don't want to call SmtpClient Builder::new every time for each email. Maybe you know how to make it more elastic?
As a solution maybe need implement .send_many(message) where we can create message for every individual user?