getting things to work a bit
This commit is contained in:
parent
760e46a2d1
commit
6913426619
20 changed files with 4607 additions and 1880 deletions
30
src/email.rs
Normal file
30
src/email.rs
Normal file
|
@ -0,0 +1,30 @@
|
|||
use color_eyre::Result;
|
||||
use lettre::{
|
||||
transport::smtp::authentication::{Credentials, Mechanism},
|
||||
Message, SmtpTransport, Transport,
|
||||
};
|
||||
use tracing::{error, info};
|
||||
|
||||
pub async fn send_email(message: Message) -> Result<()> {
|
||||
let sender = SmtpTransport::relay("mail.tfcconnection.org")
|
||||
.ok()
|
||||
.unwrap()
|
||||
.credentials(Credentials::new(
|
||||
"no-reply@mail.tfcconnection.org".to_owned(),
|
||||
"r9f36mNZFtiW4f".to_owned(),
|
||||
))
|
||||
.authentication(vec![Mechanism::Plain])
|
||||
.build();
|
||||
|
||||
match sender.send(&message) {
|
||||
Ok(res) => {
|
||||
let res: String = res.message().collect();
|
||||
info!(
|
||||
"Successfully sent email to server with this response: {:?}",
|
||||
res
|
||||
)
|
||||
}
|
||||
Err(e) => error!("There was an error sending the email: {e}"),
|
||||
}
|
||||
Ok(())
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue