External Forms Broken in 5.6+

Permalink
After doing some google searches I was not able to find anyone else with this issue. I upgraded a site from 5.5.2.1 to 5.6.0 and after the upgrade all my external forms have stopped processing. I looked at the example block included with the new C5 install but did not see any changes.

So here is what is happening:
1. When a user submits a form they get this error:

The website encountered an error while retrievinghttp://mysite.com/index.php?cID=116&bID=59&arHandle=Main&am... It may be down for maintenance or configured incorrectly.

HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request.

2. Form submissions are being logged in the dashboard logs
3. Conformation e-mails that need to go to the user and client are not being sent.

The forms on the site are not exactly 'kosher', I inherited some really ugly code and I am hoping the fix is not a complete rebuild of the forms.

Here is an example of the external for block structure:
/blocks/external_form/forms/custom_contact.php
/blocks/external_form/forms/controllers/custom_contact.php

There are no other view/edit or controllers in the mail form controllers.

Here is an example of the form:
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$form = Loader::helper('form');
?>
<form id="estimate" method="post" name="ContactForm" action="<?php echo $this->action('do_contact') ?>">
  <p>Your Name:</p>
  <input class="contenttext" name="Name" />
  <p><span class='required'>*</span>Email Address:</p>
  <input class="contenttext" name="EMail" />
  <p>Your Question:</p>
  <textarea class="contenttextwide" style="WIDTH: 340px" name="Question" rows="6"></textarea>
  <input class="submitbutton" type="submit" value="Submit" name="submit" />
  <input class="submitbutton" type="reset" value="Clear" name="submit" />
</form>


Controller:
<?php
  defined('C5_EXECUTE') or die("Access Denied.");
  class ContactExternalFormBlockController extends BlockController {
  public function action_do_contact() {
    $this->set('response', t('<b>Thank You!</b>'));
    $mh = Loader::helper('mail');
    if (defined('EMAIL_DEFAULT_FROM_ADDRESS')) {
      $mh->from(EMAIL_DEFAULT_FROM_ADDRESS, t('test@test.com'));
    } else {
      $adminUser = UserInfo::getByID(USER_SUPER_ID);
      if (is_object($adminUser)) {
        $mh->from($adminUser->getUserEmail(), t('test@test.com'));
      }
    }
     //this next part hasn't worked since updating to 5.5


The helper mail function is custom and the note in another form controller says:
"here is our new mail function - all headers and variables empty - note - this is not the built in concrete5 Zend_mail method - the zend mail method does not allow for bcc - so the class had to be extended - check the root/helper/mail.php file for this extended script."

I can attach this file if need be...

And then yet another file, thouh I have to be honest I thought these where formating the log files but after upgrading to 5.5 this is also what the customer sees, NOT the custom HTML e-mail body:
root/html/mail/contact_external_form_submission.php

<?php
defined('C5_EXECUTE') or die("Access Denied.");
$subject = t("Contact Form Submission");
$body = t("A site visitor has filled out the contact form on your website.
Name: %s
Email: %s
Question:
%s
", $Name, $EMail, $Question);
?>


So, anyone know what would cause the forms not to send in 5.6+ but allow them to send in 5.5-?

iwmconcrete
 
iwmconcrete replied on at Permalink Reply
iwmconcrete
On a side note...wow, I can't edit the above post..awesome, I made some continuity errors when copying my code - but I assure you, what I have on the site will work if I downgrade the site version
iwmconcrete replied on at Permalink Reply
iwmconcrete
Attempting to bump this topic up, I have not found any resolution to this issue. I did find out how to send HTML again (in 5.5) and I found a recommendation from jordanlaev where he admits he has stopped using External forms altogether and made his own solution for making custom contact forms, which he made available on githubhttps://github.com/jordanlev/c5_custom_contact_form.... I am hoping not to go this route as there are 8 forms on the site that need to be updated.

Has anyone using external forms even tested their forms since upgrading to 5.6?
patej replied on at Permalink Reply
patej
Wow, disappointing news... Have you found any solution yet? Or anyone else?

I just updated an old external form on my test server which has 5.6 (production one is still 5.4...) and I had the intention to switch the production server over to the test one before publishing the form but I couldn't manage to get the form controller to return anything. However, when I copied the exact same files over to the 5.4.1.1 server, everything worked as it should. I was already thinking that there must be something wrong with my test server setup, but it seems that the problem is due to upgraded c5.

Oh well, thanks for the heads up on this, deadline's approaching fast so I got to try the Jordan's one now!

--patrik