<p>Platform:</p>
<ul>
<li>Craft Solo 3.7.21</li>
<li>P&amp;T Contact Form plug in 2.2.7</li>
<li>Redactor 2.8.8</li>
</ul>
<p>I am trying to use the Contact Form plugin and having problems when using the latest version of the API. I have an old implementation from several years ago that works, but when upgrading to the most recent plugin example code get an error when trying to submit a form.</p>
<p>This works:</p>
<pre><code> &lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot; class=&quot;form1&quot;&gt;
     {{ csrfInput() }}
                &lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;contact-form/send&quot;&gt;
                {{ redirectInput('thanks?from={fromName}') }}
                &lt;h2&gt;Please enter the following:&lt;/h2&gt;
                &lt;div class=&quot;indicates-required&quot;&gt;&lt;span class=&quot;asterisk&quot;&gt;*&lt;/span&gt; indicates required&lt;/div&gt;    
                &lt;div class=&quot;mc-field-group&quot;&gt;&lt;label for=&quot;from-name&quot;&gt;Your Name&lt;/label&gt;
                    &lt;input id=&quot;from-name&quot; type=&quot;text&quot; name=&quot;fromName&quot; value=&quot;{{ message.fromName ?? '' }}&quot;&gt;
                    {{ message is defined and message ? errorList(message.getErrors('fromName')) }}
                &lt;/div&gt;
                &lt;div class=&quot;mc-field-group&quot;&gt;
                    &lt;label for=&quot;from-email&quot;&gt;Your Email &lt;span class=&quot;asterisk&quot;&gt;*&lt;/span&gt;&lt;/label&gt;
                    &lt;input id=&quot;from-email&quot; type=&quot;email&quot; name=&quot;fromEmail&quot; value=&quot;{{ message.fromEmail ?? '' }}&quot;&gt;
                    {{ message is defined and message ? errorList(message.getErrors('fromEmail')) }}
                &lt;/div&gt;
                &lt;div class=&quot;mc-field-group&quot;&gt;
                    &lt;label for=&quot;subject&quot;&gt;Subject&lt;/label&gt;
                    &lt;input id=&quot;subject&quot; type=&quot;text&quot; name=&quot;subject&quot; value=&quot;{{ message.subject ?? '' }}&quot;&gt;
                    {{ message is defined and message ? errorList(message.getErrors('subject')) }}
                &lt;/div&gt;
                &lt;div class=&quot;mc-field-group&quot;&gt;
                    &lt;label for=&quot;message&quot;&gt;Message &lt;span class=&quot;asterisk&quot;&gt;*&lt;/span&gt;&lt;/label&gt;
                    &lt;textarea rows=&quot;10&quot; cols=&quot;40&quot; id=&quot;message&quot; name=&quot;message&quot;&gt;{{ message.message ?? '' }}&lt;/textarea&gt;
                    {{ message is defined and message ? errorList(message.getErrors('message')) }}
                &lt;/div&gt;
                &lt;input id=&quot;date&quot; type=&quot;text&quot; name=&quot;date&quot;&gt;
                &lt;div class=&quot;clear&quot;&gt;
                    &lt;input type=&quot;submit&quot; value=&quot;Send&quot; class=&quot;button&quot;&gt;
                &lt;/div&gt;
            &lt;/form&gt;
</code></pre>
<p>This generates the following error message:</p>
<ul>
<li>&quot;There was a problem with your submission, please check the form and try again!&quot;</li>
</ul>
<pre><code>&lt;form method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot; class=&quot;form1&quot;&gt;
                
                {{ csrfInput() }}
                {{ actionInput('contact-form/send') }}
                {{ redirectInput('thanks?from={fromEmail}') }}

                &lt;h2&gt;Please enter the following:&lt;/h2&gt;

                &lt;div class=&quot;indicates-required&quot;&gt;&lt;span class=&quot;asterisk&quot;&gt;*&lt;/span&gt; indicates required&lt;/div&gt;    
                
                &lt;div class=&quot;mc-field-group&quot;&gt;
                    &lt;label for=&quot;from-email&quot;&gt;Your Email Address&lt;/Address&gt;&lt;span class=&quot;asterisk&quot;&gt;*&lt;/span&gt;&lt;/label&gt;
                    {{ input('email', 'fromEmail', message.fromEmail ?? '', {
                        id: 'from-email',
                        autocomplete: 'email',
                    }) }}
                    {{ message ? _self.errorList(message.getErrors('fromEmail')) }}
                &lt;/div&gt;

                &lt;div class=&quot;mc-field-group&quot;&gt;&lt;label for=&quot;first-name&quot;&gt;First Name&lt;/label&gt;
                    {{ input('text', 'firstName', message.firstName ?? '', {
                        id: 'first-name',
                        autocomplete: 'First Name',
                    }) }}
                    {{ message ? _self.errorList(message.getErrors('firstName')) }}
                &lt;/div&gt;

                &lt;div class=&quot;mc-field-group&quot;&gt;
                    &lt;label for=&quot;last-name&quot;&gt;Last Name&lt;/label&gt;
                    {{ input('text', 'lastName', message.lastName ?? '', {
                        id: 'last-name',
                        autocomplete: 'Last Name',
                    }) }}
                    {{ message ? _self.errorList(message.getErrors('lastName')) }}
                &lt;/div&gt;
                &lt;input id=&quot;date&quot; type=&quot;text&quot; name=&quot;date&quot;&gt;
                &lt;div class=&quot;clear&quot;&gt;
                    &lt;button type=&quot;submit&quot;&gt;Subscribe&lt;/button&gt;
                &lt;/div&gt;
            &lt;/form&gt;
</code></pre>
<p>Maybe the problem is obvious, but I'm not seeing it, so help is appreciated.<br />
Thanks.</p>

CC BY-SA 4.0
2021-11-16T19:26:17.437Z
My guess is it's an email settings problem (Settings->Email in the Craft control panel). Try checking the Craft `storage/logs` folder for the underlying error.
Brad Bell
CC BY-SA 4.0
2021-11-16T19:50:17.290Z
Thanks, but Email works - I can send test emails, and as I say, with the old code the form is correctly submitted and the email sent.
WRT log files, there are a bunch of them; which would I be most interested in checking?
g. eagle
CC BY-SA 4.0
2021-11-16T20:11:15.497Z
Try comparing the rendered HTML of the two versions and see if there are any obvious errors or differences?
David Kennedy
CC BY-SA 4.0
2021-11-16T23:29:48.803Z
I tested your second code example and it didn't work, as you said. However, that code isn't the example from the Contact Form plugin documentation. It's missing the error list macro and has some other changes.

I was able to get the contact form code from the documentation to work just fine. I would go back to that example and test that it works and then make your changes, one thing at at a time.
CraftQuest
CC BY-SA 4.0
2021-11-17T00:49:38.530Z
CraftQuest - You're right; the base demo code works, mine doesn't. Will do as you as you suggest and go through it line by line. Thanks.
g. eagle
<craft3><plugin-contactform>
Contact Form not sending email with most recent version of template
# Contact Form not sending email with most recent version of template

(Asked by: username_0 on 2021-11-16)

Platform:

Craft Solo 3.7.21
P&T Contact Form plug in 2.2.7
Redactor 2.8.8

I am trying to use the Contact Form plugin and having problems when using the latest version of the API. I have an old implementation from several years ago that works, but when upgrading to the most recent plugin example code get an error when trying to submit a form.
This works:
 
     {{ csrfInput() }}
                
                {{ redirectInput('thanks?from={fromName}') }}
                Please enter the following:
                * indicates required    
                Your Name
                    
                    {{ message is defined and message ? errorList(message.getErrors('fromName')) }}
                
                
                    Your Email *
                    
                    {{ message is defined and message ? errorList(message.getErrors('fromEmail')) }}
                
                
                    Subject
                    
                    {{ message is defined and message ? errorList(message.getErrors('subject')) }}
                
                
                    Message *
                    {{ message.message ?? '' }}
                    {{ message is defined and message ? errorList(message.getErrors('message')) }}
                
                
                
                    
                
            

This generates the following error message:

"There was a problem with your submission, please check the form and try again!"


                
                {{ csrfInput() }}
                {{ actionInput('contact-form/send') }}
                {{ redirectInput('thanks?from={fromEmail}') }}

                Please enter the following:

                * indicates required    
                
                
                    Your Email Address*
                    {{ input('email', 'fromEmail', message.fromEmail ?? '', {
                        id: 'from-email',
                        autocomplete: 'email',
                    }) }}
                    {{ message ? _self.errorList(message.getErrors('fromEmail')) }}
                

                First Name
                    {{ input('text', 'firstName', message.firstName ?? '', {
                        id: 'first-name',
                        autocomplete: 'First Name',
                    }) }}
                    {{ message ? _self.errorList(message.getErrors('firstName')) }}
                

                
                    Last Name
                    {{ input('text', 'lastName', message.lastName ?? '', {
                        id: 'last-name',
                        autocomplete: 'Last Name',
                    }) }}
                    {{ message ? _self.errorList(message.getErrors('lastName')) }}
                
                
                
                    Subscribe
                
            

Maybe the problem is obvious, but I'm not seeing it, so help is appreciated.
Thanks.

**Tags:** craft3, plugin-contactform

> **Comments:**
> **username_1**: My guess is it's an email settings problem (Settings->Email in the Craft control panel). Try checking the Craft `storage/logs` folder for the underlying error.  
> **username_0**: Thanks, but Email works - I can send test emails, and as I say, with the old code the form is correctly submitted and the email sent. WRT log files, there are a bunch of them; which would I be most interested in checking?  
> **username_2**: Try comparing the rendered HTML of the two versions and see if there are any obvious errors or differences?  
> **username_3**: I tested your second code example and it didn't work, as you said. However, that code isn't the example from the Contact Form plugin documentation. It's missing the error list macro and has some other changes.  I was able to get the contact form code from the documentation to work just fine. I would go back to that example and test that it works and then make your changes, one thing at at a time.  
> **username_0**: username_3 - You're right; the base demo code works, mine doesn't. Will do as you as you suggest and go through it line by line. Thanks.  

---

## 0 answers

