[Pro] Trouble with php mail() within Freeway

I’m working on a feedback form that will eventually include the reCaptcha routine, but I am stumped on a more basic problem.

When I use the form as a stand-alone php document, the php mail() function works perfectly, and I receive the email properly formatted. But when I paste this same code into a Freeway page, the mail() function fails.

I’ve tried using both the PHP Block action, and alternately adding the code as a Markup Item. In each case the feedback form works perfectly, EXCEPT for the mail() function. There are no other actions on the Freeway page.

So what is it that is preventing the mail() function from working from within a Freeway-generated page? Is there a better way to accomplish this? (I’m not using one of the actions, because I am working with the PHP Form Builder Class (which I just discovered and is pretty neat.)

Thanks for any guidance anyone might have.

The php code, if it will help, is as follows:

<?php # formtest.php // Include the PHP Form Builder Class include("../php-form-builder-class/class.form.php"); // Initialize a new session session_start(); // See if the form has already been submitted if (ISSET($_POST['cmd'])) { // Get the values from the form $fname = $_POST['fname']; $lname = $_POST['lname']; $phone = $_POST['phone']; $email = $_POST['email']; $mess = $_POST['message']; // Setup the mail fields $to = 'email@hidden'; $subject = 'Message from website user'; $message = "$fname $lname sent the following message through the mimobic website:" . "rn" . "Phone number: $phone" . "rn" . "Email address: $email" . "rn" . "rn" . "MESSAGE:" . "rn" . wordwrap($mess, 70); $headers = 'From: email@hidden'; // Send the email if (mail($to, $subject, $message, $headers)) { // If the mail was sent, provide a confirmation to the user echo "Thanks for contacting us. If your message requires a response, we'll get back to you as soon as possible."; } else { // If the mail was NOT sent, ask the user to try again echo "Oops! There was some problem with sending your message - please click your browser's 'Back' button and try sending again. If this persists, please contact us by telephone at 111-555-1212. We apologize for the inconvenience."; } // If the form hasn't yet been submitted, then display it } else { // Display the initial welcome message echo "Please contact us with questions, concerns, or requests. If you'd like a response, please make sure that you've provided a telephone number or email address, so that we know how to get back to you.


"; // Set up the form attributes $form = new form("Contact_Us"); $form->setAttributes(array( "width" => 600, "map" => array(2, 2, 1), "action" => "formtest.php" )); // Remove offending characters if(!empty($_GET["errormsg_0"])) $form->errorMsg = filter_var(stripslashes($_GET["errormsg_0"]), FILTER_SANITIZE_SPECIAL_CHARS); // Display the form fields $form->addHidden("cmd", "submit_0"); $form->addTextbox("First Name", "fname"); $form->addTextbox("Last Name", "lname"); $form->addEmail("Email Address", "email"); $form->addTextbox("Phone Number", "phone"); $form->addTextarea("Message", "message"); $form->addButton(); $form->render(); // Finish off the form display echo "



"; } ?>

dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

In the Document Setup, turn off “hide E-mail addresses” or whatever it’s called. This service of Freeway is whacking your code, changing the e-mail address you want to send the mail to into an unusable hash of HTML entities. Good for keeping your e-mail private, very bad for PHP. You can get around this by setting a variable to the e-mail address in an external text file, and referencing that value in your code, but it’s probably easier to turn off Freeway’s feature, unless you’re also planning on having your e-mail address in your site somewhere “in the clear”.

Walter


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Walter - as usual - you are a genius about seeing the tiny things that have a huge impact. Turning off the email hiding did the trick. Thanks for the advice - I appreciate your prompt response!


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options