Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getsimple 3.1 Contactable Feedback/Contact Form
#70
Hi all

I started the whole thing out when I tried to use GS Contactable plugin on a draft site

There were some other JQuery scripts on its pages, so I could't get the plugin to work as it somehow messed up other JQuery scripts on the page.

OK, I found the original JQuery plugin and tried to implement it instead of the GS Plugin.

The contact form shows up, I can fill in the inputs and even hit the SEND button, but no luck in sending the message. The form returns "error sending the message" or something like that.

These are the options of the contact form:

Code:
    var defaults = {
            url: 'mail.php',
            name: 'Name',
            email: 'Email',
            dropdownTitle: '',
            dropdownOptions: ['General', 'Website bug', 'Feature request'],
            message : 'Message',
            subject : 'A contactable message',
            submit : 'SEND',
            recievedMsg : 'Thank you for your message',
            notRecievedMsg : 'Sorry but your message could not be sent, try again later',
            disclaimer: 'Please feel free to get in touch, we value your feedback',
            hideOnSubmit: true
        };

Plugin developer says that url must be absolute.



The contact form is supposed to send data to mailing script mail.php like this:
url:options.url is the same like in defaults here

Code:
    jQuery.ajax({
                    type: 'POST',
                    url: options.url,
                    data: {
                        subject:options.subject,
                        name:jQuery('#contactable-name').val(),
                        email:jQuery('#contactable-email').val(),
                        issue:jQuery('#contactable-dropdown').val(),
                        message:jQuery('#contactable-message').val()
                    },

So far so good. Then goes mail.php, our mailing script.

Code:
<?php
    // Assign contact info
    $name = stripcslashes($_POST['name']);
    $emailAddr = stripcslashes($_POST['email']);
    $issue = stripcslashes($_POST['issue']);
    $comment = stripcslashes($_POST['message']);
    $subject = stripcslashes($_POST['subject']);    
    
    // Set headers
    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

    // Format message
    $contactMessage =  
    "<div>
    <p><strong>Name:</strong> $name <br />
    <strong>E-mail:</strong> $emailAddr <br />
    <strong>Issue:</strong> $issue </p>

    <p><strong>Message:</strong> $comment </p>

    <p><strong>Sending IP:</strong> $_SERVER[REMOTE_ADDR]<br />
    <strong>Sent via:</strong> $_SERVER[HTTP_HOST]</p>
    </div>";

    // Send and check the message status
    $response = (mail('CHANGE@YOURADDRESS.COM', $subject, $contactMessage, $headers) ) ? "success" : "failure" ;
    $output = json_encode(array("response" => $response));
    
    header('content-type: application/json; charset=utf-8');
    echo($output);
    ?>

This where the pain in the neck starts for me. As I'm next to nothing in PHP and JavaScript I have to rely upon pure logic Smile

So it occured to me, the problem is:

I don't know where and how I must place mail.php file within GS-powered site in order to have this code working. Either I'm wrong in defining the absolute path to mail.php (that is unlikely but who knows) or the path is OK but GS doesn't allow mail.php to start because of permissions or security policy or whatever.


So the question is:
Where (and how?) in GS-powered site can I place that mail.php file so that the contact form could be able to send contact messages.

Hope that explanation of my problem is understandable

Thanks Smile

Or course, I changed CHANGE@YOURADDRESS.COM for the appropriate email
Reply


Messages In This Thread
RE: Getsimple 3.1 Contactable Feedback/Contact Form - by Arkady - 2014-02-27, 21:19:48



Users browsing this thread: 1 Guest(s)