Compare commits
2 Commits
4f6dacb907
...
966254807c
Author | SHA1 | Date | |
---|---|---|---|
966254807c | |||
770e321bed |
@ -52,14 +52,16 @@ impl Mail {
|
|||||||
let content = fs::read(temp_file.path().unwrap()).unwrap();
|
let content = fs::read(temp_file.path().unwrap()).unwrap();
|
||||||
let media_type = format!("{}", temp_file.content_type().unwrap().media_type());
|
let media_type = format!("{}", temp_file.content_type().unwrap().media_type());
|
||||||
let content_type = ContentType::parse(&media_type).unwrap();
|
let content_type = ContentType::parse(&media_type).unwrap();
|
||||||
let attachment = Attachment::new(format!(
|
if let Some(name) = temp_file.name() {
|
||||||
"{}.{}",
|
let attachment = Attachment::new(format!(
|
||||||
temp_file.name().unwrap(),
|
"{}.{}",
|
||||||
temp_file.content_type().unwrap().extension().unwrap()
|
name,
|
||||||
))
|
temp_file.content_type().unwrap().extension().unwrap()
|
||||||
.body(content, content_type);
|
))
|
||||||
|
.body(content, content_type);
|
||||||
|
|
||||||
multipart = multipart.singlepart(attachment);
|
multipart = multipart.singlepart(attachment);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let email = email.subject(data.subject).multipart(multipart).unwrap();
|
let email = email.subject(data.subject).multipart(multipart).unwrap();
|
||||||
|
Loading…
Reference in New Issue
Block a user