projects
/
recipes.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove generated file 'frontend.js'
[recipes.git]
/
backend
/
src
/
email.rs
diff --git
a/backend/src/email.rs
b/backend/src/email.rs
index
b571a29
..
4d906ff
100644
(file)
--- a/
backend/src/email.rs
+++ b/
backend/src/email.rs
@@
-1,6
+1,6
@@
-use std::time::Duration;
use derive_more::Display;
use lettre::{transport::smtp::authentication::Credentials, Message, SmtpTransport, Transport};
use derive_more::Display;
use lettre::{transport::smtp::authentication::Credentials, Message, SmtpTransport, Transport};
+use std::time::Duration;
use crate::consts;
use crate::consts;
@@
-29,17
+29,29
@@
impl From<lettre::error::Error> for Error {
}
}
}
}
-pub fn send_validation(site_url: &str, email: &str, token: &str, smtp_login: &str, smtp_password: &str) -> Result<(), Error> {
+pub fn send_validation(
+ site_url: &str,
+ email: &str,
+ token: &str,
+ smtp_login: &str,
+ smtp_password: &str,
+) -> Result<(), Error> {
let email = Message::builder()
.message_id(None)
.from("recipes@gburri.org".parse()?)
.to(email.parse()?)
.subject("Recipes.gburri.org account validation")
let email = Message::builder()
.message_id(None)
.from("recipes@gburri.org".parse()?)
.to(email.parse()?)
.subject("Recipes.gburri.org account validation")
- .body(format!("Follow this link to confirm your inscription: {}/validation?token={}", site_url, token))?;
+ .body(format!(
+ "Follow this link to confirm your inscription: {}/validation?token={}",
+ site_url, token
+ ))?;
let credentials = Credentials::new(smtp_login.to_string(), smtp_password.to_string());
let credentials = Credentials::new(smtp_login.to_string(), smtp_password.to_string());
- let mailer = SmtpTransport::relay("mail.gandi.net")?.credentials(credentials).timeout(Some(consts::SEND_EMAIL_TIMEOUT)).build();
+ let mailer = SmtpTransport::relay("mail.gandi.net")?
+ .credentials(credentials)
+ .timeout(Some(consts::SEND_EMAIL_TIMEOUT))
+ .build();
if let Err(error) = mailer.send(&email) {
eprintln!("Error when sending E-mail:\n{:?}", &error);
if let Err(error) = mailer.send(&email) {
eprintln!("Error when sending E-mail:\n{:?}", &error);