all reference forms and health apis are done
This commit is contained in:
parent
65f186fadc
commit
3f8b9cb5d8
10 changed files with 630 additions and 29 deletions
|
@ -459,11 +459,13 @@ pub async fn mt_form(MultipartForm(form): MultipartForm<MtForm>) -> HttpResponse
|
|||
};
|
||||
let mut path: Option<String> = Some(String::from(""));
|
||||
let mut file_exists = false;
|
||||
let mut filename = String::from("");
|
||||
log::info!("{:?}", form);
|
||||
log::info!("{:?}", file_exists);
|
||||
if let Some(f) = form.file {
|
||||
if let Some(file) = f.file_name {
|
||||
if let Some(ext) = file.rsplit(".").next() {
|
||||
filename = format!("{}.{}", filename_noext, ext);
|
||||
path = Some(format!("./tmp/{}.{}", filename_noext, ext));
|
||||
} else {
|
||||
path = Some(format!("./tmp/{}", file));
|
||||
|
@ -485,8 +487,7 @@ pub async fn mt_form(MultipartForm(form): MultipartForm<MtForm>) -> HttpResponse
|
|||
let multi = if file_exists {
|
||||
let filebody = fs::read(path.clone().unwrap_or_default());
|
||||
let content_type = ContentType::parse("image/jpg").unwrap();
|
||||
let attachment =
|
||||
Attachment::new(path.unwrap_or_default()).body(filebody.unwrap(), content_type);
|
||||
let attachment = Attachment::new(filename).body(filebody.unwrap(), content_type);
|
||||
log::info!("{:?}", attachment);
|
||||
MultiPart::alternative_plain_html(String::from("Testing"), email.to_string())
|
||||
.singlepart(attachment)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue