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
|
@ -410,11 +410,13 @@ pub async fn health_form(MultipartForm(form): MultipartForm<HealthForm>) -> Http
|
|||
};
|
||||
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));
|
||||
|
@ -436,8 +438,7 @@ pub async fn health_form(MultipartForm(form): MultipartForm<HealthForm>) -> Http
|
|||
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)
|
||||
|
@ -452,7 +453,7 @@ pub async fn health_form(MultipartForm(form): MultipartForm<HealthForm>) -> Http
|
|||
.unwrap(),
|
||||
)
|
||||
.to("Chris Cochrun <chris@tfcconnection.org>".parse().unwrap())
|
||||
// .to("Ethan Rose <ethan@tfcconnection.org>".parse().unwrap())
|
||||
.to("Ethan Rose <ethan@tfcconnection.org>".parse().unwrap())
|
||||
.subject(email_subject)
|
||||
.multipart(multi)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue