fix mail error
This commit is contained in:
parent
2032b7e0db
commit
f4cb051b84
@ -128,26 +128,37 @@ Der Vorstand
|
|||||||
.parse()
|
.parse()
|
||||||
.unwrap());
|
.unwrap());
|
||||||
let splitted = send_to.split(',');
|
let splitted = send_to.split(',');
|
||||||
|
let send_mail = false;
|
||||||
for single_rec in splitted {
|
for single_rec in splitted {
|
||||||
email = email.bcc(single_rec.parse().unwrap());
|
match single_rec.parse() {
|
||||||
|
Ok(val) => {
|
||||||
|
email = email.bcc(val);
|
||||||
|
send_mail = true;
|
||||||
|
}
|
||||||
|
Err(_) => {
|
||||||
|
println!("Error in mail: {single_rec}");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let email = email
|
if send_mail {
|
||||||
.subject("ASKÖ Ruderverein Donau Linz | Vereinsgebühren")
|
let email = email
|
||||||
.header(ContentType::TEXT_PLAIN)
|
.subject("ASKÖ Ruderverein Donau Linz | Vereinsgebühren")
|
||||||
.body(content)
|
.header(ContentType::TEXT_PLAIN)
|
||||||
.unwrap();
|
.body(content)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
let creds =
|
let creds =
|
||||||
Credentials::new("no-reply@rudernlinz.at".to_owned(), smtp_pw.clone());
|
Credentials::new("no-reply@rudernlinz.at".to_owned(), smtp_pw.clone());
|
||||||
|
|
||||||
let mailer = SmtpTransport::relay("mail.your-server.de")
|
let mailer = SmtpTransport::relay("mail.your-server.de")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.credentials(creds)
|
.credentials(creds)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Send the email
|
// Send the email
|
||||||
mailer.send(&email).unwrap();
|
mailer.send(&email).unwrap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user