Question
It is necessary to send an email to the selected user with an HTML template and a file upon clicking a button, but the file needs to be selected through the system file selection window and not saved in the database, only sent. I understand how to send a pre-uploaded file along with the template to the selected user, but specifically without uploading the file to the database ā that's where I'm stuck.
Answer
We call linkToFileUpload and pass the email sending action code as embedded code. linkToFileUpload passes the file structure to the $#input variable similar to a File type field, so we can pass it to the files parameter of the emailSend function.
Button action code:
=: linkToFileUpload(code: $code; title: "*"; limit: 1; type: "*"; var: "email" = "some@email.com")
```code:totum
=: emailSend(to: $#email; title: "some another title"; body: "some another test body"; files: $#input)
```
Thus, the file will be sent without saving to the server's HDD.