# No Clue about Formit

**URL:** <https://community.modx.com/t/no-clue-about-formit/7071>\
**Category:** Getting Started\
**Created:** [September 21, 2023, 2:34pm UTC](https://community.modx.com/t/no-clue-about-formit/7071 "2023-09-21T14:34:05Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Password](https://community.modx.com/letter_avatar_proxy/v4/letter/p/ad7895/32.png) [@Password](https://community.modx.com/u/Password)\
**Post date:** [September 21, 2023, 2:34pm UTC](https://community.modx.com/t/no-clue-about-formit/7071/1 "2023-09-21T14:34:05Z")

</div>

Hello

I can’t get, how formit works to send out email from forms.  
I gut, That I first have to create ha HTML form page…and then? Sadly, the MODX docs are not helping here at all.  
They write

> Simply place the FormIt snippet call into the Resource that contains the form you want to use.  
> But…how do I do that? I have installed Formit, FormDataManager, mtChaptcha, JSON Form Builder, HumanPresence and NoSpam.

Can you explain how I have to go on at a low knowledge level? 🙂  
Thanks.

---

<div class="post-metadata">

**Author:** ![halftrainedharry](https://community.modx.com/user_avatar/community.modx.com/halftrainedharry/32/1063_2.png) [@halftrainedharry](https://community.modx.com/u/halftrainedharry)\
**Post date:** [September 21, 2023, 2:37pm UTC](https://community.modx.com/t/no-clue-about-formit/7071/2 "2023-09-21T14:37:19Z")

</div>

Maybe this post helps:

> [@Walkthrough on formit](https://community.modx.com/t/walkthrough-on-formit/6195/2):
>
> In short, you have to add a call to the FormIt snippet and a normal HTML form to your page. Here is a basic example: (This form actually does nothing at all.) [[!FormIt? &hooks=`` &validate=`myfield:required` &successMessage=`Successfully sent!`]] [[!+fi.successMessage]] [[!+fi.validation\_error\_message]] \<form id="myform" action="[[~[[\*id]]]]" method="post"\> \<div\> [[!+fi.error.myfield]] \<label for="myfield"\>my Field\</label\> \<input type="text" name="myfie…

---

<div class="post-metadata">

**Author:** ![Password](https://community.modx.com/letter_avatar_proxy/v4/letter/p/ad7895/32.png) [@Password](https://community.modx.com/u/Password)\
**Post date:** [September 21, 2023, 4:11pm UTC](https://community.modx.com/t/no-clue-about-formit/7071/3 "2023-09-21T16:11:45Z")

</div>

Thanks for the link. I posted the 2nd form example, enabled SMTP with valid credentials and also posted that quickemail test. I got error messages:

```auto
System Settings (used if property is missing):
emailsender System Setting: Turn on Javascript!
site_name System Setting: [Site name]
Properties (from parameters, property set, or snippet default properties:
Tpl chunk name:
subject:
to:
fromName:
replyTo:
emailSender:
allowHtml: 1
message:
Final Values (actually used when sending email):
subject: Default Subject
to: Turn on Javascript!
fromName: QuickEmail
replyTo: Turn on Javascript!
emailSender: Turn on Javascript!
allowHtml: 1
Message Body: Default Message
Send Failed
Mailer error info: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Server Debug Information:

2023-09-21 16:06:30 SERVER -> CLIENT: 

SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

```

The SMTP credentials are correct. And I don’t know why the debugger tells me to turn on JS. It is not turned off. Does the debugger mean, in the browser? Or in Modx?

---

<div class="post-metadata">

**Author:** ![jako](https://community.modx.com/user_avatar/community.modx.com/jako/32/618_2.png) [@jako](https://community.modx.com/u/jako)\
**Post date:** [September 21, 2023, 4:16pm UTC](https://community.modx.com/t/no-clue-about-formit/7071/4 "2023-09-21T16:16:44Z")

</div>

It looks like you have [emo](https://extras.modx.com/package/emo) installed. Please surround your QuickEmail snippet call with `<!-- emo-exclude -->` and `<!-- /emo-exclude -->`

---

<div class="post-metadata">

**Author:** ![jako](https://community.modx.com/user_avatar/community.modx.com/jako/32/618_2.png) [@jako](https://community.modx.com/u/jako)\
**Post date:** [September 21, 2023, 4:18pm UTC](https://community.modx.com/t/no-clue-about-formit/7071/5 "2023-09-21T16:18:43Z")

</div>

`SMTP connect() failed` means that the MODX SMTP system settings are not working.

---

<div class="post-metadata">

**Author:** ![Password](https://community.modx.com/letter_avatar_proxy/v4/letter/p/ad7895/32.png) [@Password](https://community.modx.com/u/Password)\
**Post date:** [September 21, 2023, 4:27pm UTC](https://community.modx.com/t/no-clue-about-formit/7071/6 "2023-09-21T16:27:53Z")

</div>

> It looks like you have [emo](https://extras.modx.com/package/emo) installed. Please surround your QuickEmail snippet call with `<!-- emo-exclude -->` and `<!-- /emo-exclude -->`

I did not install emo. It is still downloadable.

> SMTP connect() failed` means that the MODX SMTP system settings are not working.

Yeah I think so. But they are correct (Username, passwort, port and server name are the same I use in Thunderbird and work).  
The only thing is, I don’t know, if SSL or TLS is used. Tb setting is “SSL/TLS” But I tried both.  
But the JS errors, they won’t com from SMTP, will they?

---

<div class="post-metadata">

**Author:** ![jako](https://community.modx.com/user_avatar/community.modx.com/jako/32/618_2.png) [@jako](https://community.modx.com/u/jako)\
**Post date:** [September 21, 2023, 4:33pm UTC](https://community.modx.com/t/no-clue-about-formit/7071/7 "2023-09-21T16:33:34Z")

</div>

Sorry, the NoSpam Package is a very old fork of my emo Package. I am not sure if this package offers the possibility to exclude sections in the page code from processing. You can switch to the emo package, which is actively maintained.

---

<div class="post-metadata">

**Author:** ![Password](https://community.modx.com/letter_avatar_proxy/v4/letter/p/ad7895/32.png) [@Password](https://community.modx.com/u/Password)\
**Post date:** [September 21, 2023, 4:41pm UTC](https://community.modx.com/t/no-clue-about-formit/7071/8 "2023-09-21T16:41:09Z")

</div>

I deleted/deinstalled the noSpam package. Now, I see some more.  
The Value **emailsender System Setting** ,_To_ and _sender_ is now the mail address, which I entered at the MODX installation. For sending out the forms, I would like to use another account, I just created for the formmailer. With a different password. Therefore, that can’t work 😉

How do I use the SMTP credentials entered in the system setttings for formit but only for formit and continue with the other credentials at the rest of MODX?

---

<div class="post-metadata">

**Author:** ![jako](https://community.modx.com/user_avatar/community.modx.com/jako/32/618_2.png) [@jako](https://community.modx.com/u/jako)\
**Post date:** [September 21, 2023, 5:38pm UTC](https://community.modx.com/t/no-clue-about-formit/7071/9 "2023-09-21T17:38:48Z")

</div>

I am not sure, if it is possible to use own SMTP settings in Formit. It uses the system settings to send the mails. You can change the from/to with snippet properties.

---

<div class="post-metadata">

**Author:** ![Password](https://community.modx.com/letter_avatar_proxy/v4/letter/p/ad7895/32.png) [@Password](https://community.modx.com/u/Password)\
**Post date:** [September 21, 2023, 6:10pm UTC](https://community.modx.com/t/no-clue-about-formit/7071/10 "2023-09-21T18:10:40Z")

</div>

I changed the base mail address and then I got a Success. Emails get sent via Quickmail. But the part of the form is not sent out:  
[[!FormIt?  
&hooks=`email,redirect`  
&validate=`myfield:required`  
&redirectTo=`1`  
&emailTpl=`myEmailTemplate`  
&emailSubject=`Test Mail`  
&emailTo=`[real mail address]`  
&emailHtml=`0`  
&submitVar=`mySubmit`  
]]  
and I also won’t get a redirect.

---

<div class="post-metadata">

**Author:** ![Password](https://community.modx.com/letter_avatar_proxy/v4/letter/p/ad7895/32.png) [@Password](https://community.modx.com/u/Password)\
**Post date:** [September 22, 2023, 5:59pm UTC](https://community.modx.com/t/no-clue-about-formit/7071/11 "2023-09-22T17:59:57Z")

</div>

Does no one know a soulution? This is essential for my website, I can’t start it without a mailing script.  
SMTP seems to work though.

---

<div class="post-metadata">

**Author:** ![halftrainedharry](https://community.modx.com/user_avatar/community.modx.com/halftrainedharry/32/1063_2.png) [@halftrainedharry](https://community.modx.com/u/halftrainedharry)\
**Post date:** [September 22, 2023, 6:32pm UTC](https://community.modx.com/t/no-clue-about-formit/7071/12 "2023-09-22T18:32:11Z")

</div>

Does the form work correctly without the `email` hook?  
Did you check the MODX error log (in the manager → “Manage” → “Reports” → “Error Log”) to see if something gets logged there when you try to send the form.

---

<div class="post-metadata">

**Author:** ![Password](https://community.modx.com/letter_avatar_proxy/v4/letter/p/ad7895/32.png) [@Password](https://community.modx.com/u/Password)\
**Post date:** [September 22, 2023, 6:46pm UTC](https://community.modx.com/t/no-clue-about-formit/7071/13 "2023-09-22T18:46:55Z")

</div>

yes. I tried one send, and I got this one:  
[2023-09-22 20:41:15] (ERROR @ /home/[…]/modx/core/components/formit/src/FormIt/Hook/Email.php : 325) [FormIt] An error occurred while trying to send the email. Message body empty  
It says message body empty. But I have entered something:  
 ![Bild_043](https://modx-community.s3.dualstack.us-east-1.amazonaws.com/original/2X/e/eabaa1766383dae5c3e229a6b5666cb3fabec2f4.jpeg)  
Although, if the field is really empty, I get “This field is required. my Field” (I can’t attach two images in one post). This does not create an error.

---

<div class="post-metadata">

**Author:** ![halftrainedharry](https://community.modx.com/user_avatar/community.modx.com/halftrainedharry/32/1063_2.png) [@halftrainedharry](https://community.modx.com/u/halftrainedharry)\
**Post date:** [September 22, 2023, 6:56pm UTC](https://community.modx.com/t/no-clue-about-formit/7071/14 "2023-09-22T18:56:07Z")

</div>

> [@Password](#):
>
> `&emailTpl=`myEmailTemplate``

Did you create a chunk with the name “myEmailTemplate” that contains the text to be sent (and some placeholders like `[[+myfield]]` for the form fields in it)?

---

<div class="post-metadata">

**Author:** ![Password](https://community.modx.com/letter_avatar_proxy/v4/letter/p/ad7895/32.png) [@Password](https://community.modx.com/u/Password)\
**Post date:** [September 22, 2023, 7:27pm UTC](https://community.modx.com/t/no-clue-about-formit/7071/15 "2023-09-22T19:27:12Z")

</div>

Ahhh, that is the reason. Thanks for noticing. I changed it to the standard template, now I get mails.  
But the mails only contain:

```auto
<p>[[+fields]]</p>

```

with &emailHtml=`0` and

```auto
[[+fields]]

```

with &emailHtml=`1

I would expect to get what I have entered. On the email template, it is exactly this code, I get via email.  
But there is a note “The default chunk used for the email. Please do not edit this chunk, as this will be overwritten when updating FormIt.”

---

<div class="post-metadata">

**Author:** ![halftrainedharry](https://community.modx.com/user_avatar/community.modx.com/halftrainedharry/32/1063_2.png) [@halftrainedharry](https://community.modx.com/u/halftrainedharry)\
**Post date:** [September 22, 2023, 7:41pm UTC](https://community.modx.com/t/no-clue-about-formit/7071/16 "2023-09-22T19:41:51Z")

</div>

So what exactly did you do? Set `&emailTpl=`fiDefaultEmailTpl``?  
Don’t do this. Either leave the `&emailTpl` property empty or (much better), create your own chunk with the text and placeholders you want.

Also maybe take a look at the documentation here:  
[https://docs.modx.com/current/en/extras/formit/formit.hooks/email#usage](https://docs.modx.com/current/en/extras/formit/formit.hooks/email#usage)

---

<div class="post-metadata">

**Author:** ![Password](https://community.modx.com/letter_avatar_proxy/v4/letter/p/ad7895/32.png) [@Password](https://community.modx.com/u/Password)\
**Post date:** [September 23, 2023, 9:19am UTC](https://community.modx.com/t/no-clue-about-formit/7071/17 "2023-09-23T09:19:11Z")

</div>

I have had enough of this not working crap in the meantime. Why is this so complicated? Why can’t there be a simple form with one page of code insteadt of those 1000 referrers and variables?

I tried SPForm, which was looking easier. But that does not send out emails and sometimes generates white pages. Even at the creators website.

Also, the documentation of MODX/Formit still leaves something to be desired.

Please, I’m not saying anything against you guys. Thanks a lot for your help so far.  
I just have invested so much time until now with no result, I will think of changing the contact page to a simple mailto link…

It was very easy when I last had a website. But that is \>15 years ago.

---

<div class="post-metadata">

**Author:** ![halftrainedharry](https://community.modx.com/user_avatar/community.modx.com/halftrainedharry/32/1063_2.png) [@halftrainedharry](https://community.modx.com/u/halftrainedharry)\
**Post date:** [September 23, 2023, 2:07pm UTC](https://community.modx.com/t/no-clue-about-formit/7071/18 "2023-09-23T14:07:17Z")

</div>

So what exactly is the remaining issue with your _FormIt_ form? The email chunk?

**Chunks** with **placeholders** in it are a basic part of MODX (and used on every site for various tasks).

With _FormIt_, every field in your form will become a placeholder in the email chunk (with the name of the form-field as it’s name).  
E.g. The field `<input type="text" name="message" ...>` becomes the placeholder `[[+message]]`.

When you create a **chunk** with content like this

```html
A website visitor left the following message:
[[+message]]

```

`[[+message]]` will get replaced with whatever the user entered into the form field when the email is sent.

* * *

> [@Password](#):
>
> Why is this so complicated?

There is usually a tradeoff between simplicity and flexibility. In MODX you have full control over the markup of your form and what exactly happens to the data after the form is sent.  
If you make “a simple form with one page of code”, people will then start complaining that the form can’t do exactly what they want it to do.

> [@Password](#):
>
> But that does not send out emails and sometimes generates white pages. Even at the creators website.

If there are problems with the _SPForm_ extra, then please report them on [Github](https://github.com/BobRay/SPForm) so that they can get fixed.

> [@Password](#):
>
> Also, the documentation of MODX/Formit still leaves something to be desired.

The documentation of MODX is a community effort. Feel free to improve it by submitting your pull requests to [this Github repository](https://github.com/modxorg/Docs).

> [@Password](#):
>
> Please, I’m not saying anything against you guys.

The MODX community is very small. The people who answer your questions here are very likely to be the same people that create extras, fix bugs in the MODX core code and try to improve the documentation.

---

<div class="post-metadata">

**Author:** ![quentin100](https://community.modx.com/user_avatar/community.modx.com/quentin100/32/1100_2.png) [@quentin100](https://community.modx.com/u/quentin100)\
**Post date:** [September 29, 2023, 3:43pm UTC](https://community.modx.com/t/no-clue-about-formit/7071/19 "2023-09-29T15:43:05Z")

</div>

If you are struggling with FormIt, can I suggest you start with Formalicious. It provides all the functionality of FormIt and a nice easy to use interface to build the forms with.

[https://extras.modx.com/package/formalicious](https://extras.modx.com/package/formalicious)
