Remove attachments from formit emails in modX

232 views Asked by At

Formit automatically collects the data of all your fields and places them in an email whenever you use the "email" hook. However, I want the email to be sent with all the field data but I want to leave out the attachments. I was able to disable the attachments within the email hook itself but this will be overwritten whenever you update Formit.

Is there a way to remove the attachments or disable them just for the email?

1

There are 1 answers

1
curveball On BEST ANSWER

You can chain hooks in FormIt extra one after another like ... &hooks = 'spam,customhook,email,redirect' .... So, just from the top of my head, I would place a custom hook before email hook. The custom one does some job with submitted files (for example, uploads them to some folder) and then unsets/removes the corresponding fields as if the files were not uploaded and the corresponding fields didn't even exist so that the email hook can send emails afterwards w/o the attachments.