use proper encoding
This commit is contained in:
parent
23f5e3ca4a
commit
58b498b9de
@ -1,10 +1,7 @@
|
|||||||
use std::{error::Error, fs};
|
use std::{error::Error, fs};
|
||||||
|
|
||||||
use lettre::{
|
use lettre::{
|
||||||
message::{
|
message::{header::ContentType, Attachment, MultiPart, SinglePart},
|
||||||
header::{self, ContentType},
|
|
||||||
Attachment, MultiPart, SinglePart,
|
|
||||||
},
|
|
||||||
transport::smtp::authentication::Credentials,
|
transport::smtp::authentication::Credentials,
|
||||||
Message, SmtpTransport, Transport,
|
Message, SmtpTransport, Transport,
|
||||||
};
|
};
|
||||||
@ -49,11 +46,7 @@ impl Mail {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut multipart = MultiPart::mixed().singlepart(
|
let mut multipart = MultiPart::mixed().singlepart(SinglePart::plain(data.body));
|
||||||
SinglePart::builder()
|
|
||||||
.header(header::ContentType::TEXT_HTML)
|
|
||||||
.body(String::from(data.body)),
|
|
||||||
);
|
|
||||||
|
|
||||||
for temp_file in &data.files {
|
for temp_file in &data.files {
|
||||||
let content = fs::read(temp_file.path().unwrap()).unwrap();
|
let content = fs::read(temp_file.path().unwrap()).unwrap();
|
||||||
@ -69,11 +62,7 @@ impl Mail {
|
|||||||
multipart = multipart.singlepart(attachment);
|
multipart = multipart.singlepart(attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
let email = email
|
let email = email.subject(data.subject).multipart(multipart).unwrap();
|
||||||
.subject(data.subject)
|
|
||||||
.header(ContentType::TEXT_PLAIN)
|
|
||||||
.multipart(multipart)
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let creds = Credentials::new("no-reply@rudernlinz.at".to_owned(), smtp_pw);
|
let creds = Credentials::new("no-reply@rudernlinz.at".to_owned(), smtp_pw);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user