Answer the question
In order to leave comments, you need to log in
MODX - FormIt. How to get an attachment without attaching files?
Hello, I just can’t find a solution to an unpopular problem:
A person wants to request files, fills out a contact form, and he receives an email with files in an attachment in response. (So far I could only implement sending a letter to the specified address and a link to the files in the body of the letter, but I would like them to also have attachments.)
It is necessary that when sending the form through FormIt, an email with attachments consisting of files specified by the site administrator. Moreover, the user who sends the form does not attach any attachments. Those. they must be sewn into the letter template, or somehow else ...
Optionwith an attempt to hide file fields when submitting the form does not work, since you cannot attach files via value by default, as this is unsafe, and generally wrong)
Answer the question
In order to leave comments, you need to log in
A simple option out of the box is to use the FormItAutoResponder hook and its fiarFiles parameter.
https://docs.modx.com/current/en/extras/formit/for...
You can also write a custom hook. https://docs.modx.com/current/en/extras/formit/for...
In short, a snippet for sending a letter is created (possible via modMail), a body with the necessary files is created in this snippet and sent to the user on his e- mail ($hook->getValue('email')). The name of the hook must be written in the &hooks parameter of the snippet, after the email hook.
In addition to the FormItAutoResponder hook and its fiarFiles parameter , I note that the full address with "hosting levels" must be specified in the file path.
Those. open the config.core.php file at the root and copy the full path to the site from there without /core/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question