contact form will not work

Support Forums Gris – HTML Template contact form will not work

Viewing 15 posts - 1 through 15 (of 22 total)
  • Author
    Posts
  • #5516
    Steve
    Participant

    I cannot get the contact form to work – no matter what I try (yes, i followed your instructions – I keep getting the error code: Invalid address: TO_EMAILYou must provide at least one recipient email address. MSG_SEND_ERROR what to do?

    #5518
    CreaboxThemes
    Keymaster

    Hi Steve,

    have you edited the options ‘TO_NAME’ and ‘TO_EMAIL’ in the file contact.php? Please,
    make sure that the options ‘TO_EMAIL’ and ‘SMTP_USERNAME’ are the same.

    And, have you uploaded your files to a server? Can you send me your url to check the problem?

    Regards

    #5521
    Steve
    Participant

    thanks. I have deleted and reloaded files, changed values and now I no longer get the error message, however now the contact form does not work at all. I press send and nothing happens. I suspect that it might be a port issue – as I am using Gmail and I see that it has port 25 for smtp. I did try to change this to port 465 in case, but still nothing happens. Please advise? url is http://www.itgroup.net.au

    #5526
    CreaboxThemes
    Keymaster

    Hi Steve,

    I have made some changes in the file contact.php. Download it from here and replace it in your folder. Check it and tell me if it works correctly.

    Regards

    #5527
    Steve
    Participant

    thanks. downloaded your form, uploaded to web site and tried contact form again – but nothing at all happens. I put in my name, email address and comments, press send – but nothing at all. please advise.

    #5531
    CreaboxThemes
    Keymaster

    Hi,

    I have checked your website and there is an internal server error with the file contact.php. Have you uploaded it to your server?

    The error is the next:
    Failed to load resource: the server responded with a status of 500 (Internal Server Error)

    Regards

    #5533
    Steve
    Participant

    thanks – yes, I have uploaded it to the server. Just did it again then – still nothing. please urgently advise – I really need this form to work !

    #5534
    CreaboxThemes
    Keymaster

    Hi Steve,

    I don’t know the problem exactly when it happens a 500 server error.

    We can try the next solution. In you file scripts.js, look for the next code:

    $contactform.submit(function(){
         $.ajax({
              type: "POST",
    	  url: "php/contact.php",
    	  data: $(this).serialize(),
    	  success: function(msg)
    	  {
    	       if(msg == 'SEND'){
    	            $('.error-message-2').hide();
                        $('.success-message-2').hide();
                        $contactform.hide().delay(3000).fadeIn();
                        $('#contactform input').val('');
                        $('#contactform textarea').val('');
                        $('.success-message-2').html('<div class="success-message-2">'+ $success +'</div>');
                        $('.success-message-2').fadeIn().delay(2000).fadeOut();
    	       }
    	       else{
    		    $('.success-message-2').hide();
                        $('.error-message-2').hide();
                        $('.error-message-2').html('<div class="error-message-2">'+ msg +'</div>');
                        $('.error-message-2').fadeIn().delay(3000).fadeOut();
    	       }
    	  }
         });
         return false;
    });

    Change the option type: “POST” to type: “GET” and tell me if it works.

    Regards

    #5535
    Steve
    Participant

    Hi,
    I have done that – still no good. Note: I am NOT using Word Press – i use HTML in dreamweaver

    My error_log shows:

    Fri Oct 28 18:45:07 2016] [error] [client 1.129.97.86] PHP Warning: require_once(../../../../../wp-config.php): failed to open stream: No such file or directory in /home/itgroup/public_html/php/contact.php on line 7, referer: http://www.itgroup.net.au/
    [Fri Oct 28 18:45:07 2016] [error] [client 1.129.97.86] PHP Fatal error: require_once(): Failed opening required ‘../../../../../wp-config.php’ (include_path=’.:/usr/share/pear:/usr/share/php’) in /home/itgroup/public_html/php/contact.php on line 7, referer: http://www.itgroup.net.au/

    L

    Note: I am NOT using Word Press – i use HTML in dreamweaver

    #5536
    CreaboxThemes
    Keymaster

    Hi,

    I know that it is the html template.

    Maybe there is a problem with the relative paths in the file contact.php. In this file, change the next code:

    require_once('config.php');
    require_once('phpmailer/phpmailer.php');

    And use absolute paths in this way:

    require_once('http://www.itgroup.net.au/php/config.php');
    require_once('http://www.itgroup.net.au/php/phpmailer/phpmailer.php');

    I think that it is the correct absolute paths. But, I don’t know exactly. Please, be sure to type the exact paths.

    Regards

    • This reply was modified 6 years, 11 months ago by CreaboxThemes.
    #5538
    Steve
    Participant

    thanks.
    that is the correct path – but still it does nothing when you press send.

    here is the error:
    [Fri Oct 28 22:05:48 2016] [error] [client 1.129.97.86] PHP Warning: require_once(http://www.itgroup.net.au/php/config.php): failed to open stream: no suitable wrapper could be found in /home/itgroup/public_html/php/contact.php on line 7, referer: http://www.itgroup.net.au/

    here is my contact.php (i note it keeps talking about word press – which I don’t have or don’t use though ???)

    <?php
    //Global WordPress
    global $wpdb;

    if(!isset($wpdb))
    {
    require_once(‘http://www.itgroup.net.au/php/config.php&#8217;);
    require_once(‘http://www.itgroup.net.au/php/phpmailer/phpmailer.php&#8217;);
    }

    function isEmail($email) {
    return(preg_match(“/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i”, $email));
    }

    include(‘../language.php’);

    if($_POST) {

    $contact_name = ($_POST[‘name’]);
    $contact_email = ($_POST[’email’]);
    $contact_message = ($_POST[‘message’]);
    $codigo = ($_POST[‘codigo’]);
    $codigo_prin = ($_POST[‘codigo_prin’]);

    if( $contact_name == ” || $contact_message == ” ){
    $array = array();
    $array[‘valid’] = 0;
    $array[‘message’] = $error2;
    echo json_encode($array);
    }elseif(!isEmail($contact_email)) {
    $array = array();
    $array[‘valid’] = 0;
    $array[‘message’] = $error1;
    echo json_encode($array);
    }elseif ( $codigo != $codigo_prin) {
    $array = array();
    $array[‘valid’] = 0;
    $array[‘message’] = $error3;
    echo json_encode($array);
    }else {
    $array = array();
    $array[‘valid’] = 1;
    $array[‘message’] = $success2;
    echo json_encode($array);
    $to=verde_top(‘contact_email’);
    $subject=verde_top(‘meta_title’).’ – Contact Form’;
    $body=”Name: ” .$contact_name.”<br/>”;
    $body .=”Email: ” .$contact_email.”<br/>”;
    $body .=”Message: ” .$contact_message;
    $headers = “MIME-Version: 1.0\r\n”;
    $headers .= “Content-type: text/html; charset=iso-8859-1\r\n”;
    $headers .= “From: “.$contact_name.” <“.$contact_email.”>\r\n”;
    $headers .= “Reply-To: “.$contact_name.” <“.$contact_email.”>\r\n”;

    wp_mail($to, $subject, $body, $headers);
    }
    }

    ?>

    #5540
    CreaboxThemes
    Keymaster

    Hi,

    use the default code and tell me if it works:

    <?php 
    
    	require_once('http://www.itgroup.net.au/php/config.php');
    	require_once('http://www.itgroup.net.au/php/phpmailer/phpmailer.php');
    
    	// Sender Info
    	$name = trim($_POST['name']);
    	$email = trim($_POST['email']);
    	$message = trim($_POST['message']);
    	$err = "";
    	
    	// Check Info
    	$pattern = "^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$^";
    	if(!preg_match_all($pattern, $email, $out)) {
    		$err = MSG_INVALID_EMAIL; // Invalid email
    	}
    	if(!$email) {
    		$err = MSG_INVALID_EMAIL; // No Email
    	}	
    	if(!$message) {
    		$err = MSG_INVALID_MESSAGE; // No Message
    	}
    	if (!$name) {
    		$err = MSG_INVALID_NAME; // No name 
    	}
    
    	//define the headers we want passed. Note that they are separated with \r\n
    	// $headers = "From: ".$name." <".$email.">\r\nReply-To: ".$email.""	$body=include(_template_path);
    	$body=include(TEMPLATE_PATH);
    
    	$mail=new PHPMailer();
    	
    	$mail->SetFrom($email,$name); 
    	$mail->AddAddress(TO_EMAIL,TO_NAME);
    
    	//$mail->IsSMTP(); // enable SMTP
    	$mail->SMTPSecure='ssl';
    	$mail->SMTPAuth=true;
    	$mail->Host=SMTP_HOST;
    	$mail->Port=25; 
    	$mail->Username=SMTP_USERNAME;
    	$mail->Password=SMTP_PASSWORD;
    		
    	$mail->Subject=SUBJECT;
    	$mail->MsgHTML($body);
    
    	if (!$err){
    
    		//send the email
    		// $sent = mail(TO_EMAIL,SUBJECT,$message,$headers); 
    		
    		if ($mail->Send()) {
    				// If the message is sent successfully print
    				echo "SEND"; 
    			} else {
    				// Display Error Message
    				echo MSG_SEND_ERROR; 
    			}
    	} else {
    		echo $err; // Display Error Message
    	}
    ?>

    Regards

    #5542
    Steve
    Participant

    thanks – however, still not working. Error log shows:

    [Sat Oct 29 09:05:54 2016] [error] [client 1.129.97.116] PHP Warning: require_once(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /home/itgroup/public_html/php/contact.php on line 3, referer: http://www.itgroup.net.au/
    [Sat Oct 29 09:05:54 2016] [error] [client 1.129.97.116] PHP Warning: require_once(http://www.itgroup.net.au/php/config.php): failed to open stream: no suitable wrapper could be found in /home/itgroup/public_html/php/contact.php on line 3, referer: http://www.itgroup.net.au/
    [Sat Oct 29 09:05:54 2016] [error] [client 1.129.97.116] PHP Fatal error: require_once(): Failed opening required ‘http://www.itgroup.net.au/php/config.php&#8217; (include_path=’.:/usr/share/pear:/usr/share/php’) in /home/itgroup/public_html/php/contact.php on line 3, referer: http://www.itgroup.net.au/
    [Sat Oct 29 09:05:55 2016] [error] [client 1.129.97.116] PHP Warning: require_once(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /home/itgroup/public_html/php/contact.php on line 3, referer: http://www.itgroup.net.au/
    [Sat Oct 29 09:05:55 2016] [error] [client 1.129.97.116] PHP Warning: require_once(http://www.itgroup.net.au/php/config.php): failed to open stream: no suitable wrapper could be found in /home/itgroup/public_html/php/contact.php on line 3, referer: http://www.itgroup.net.au/
    [Sat Oct 29 09:05:55 2016] [error] [client 1.129.97.116] PHP Fatal error: require_once(): Failed opening required ‘http://www.itgroup.net.au/php/config.php&#8217; (include_path=’.:/usr/share/pear:/usr/share/php’) in /home/itgroup/public_html/php/contact.php on line 3, referer: http://www.itgroup.net.au/
    [Sat Oct 29 09:05:56 2016] [error] [client 1.129.97.116] PHP Warning: require_once(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /home/itgroup/public_html/php/contact.php on line 3, referer: http://www.itgroup.net.au/
    [Sat Oct 29 09:05:56 2016] [error] [client 1.129.97.116] PHP Warning: require_once(http://www.itgroup.net.au/php/config.php): failed to open stream: no suitable wrapper could be found in /home/itgroup/public_html/php/contact.php on line 3, referer: http://www.itgroup.net.au/
    [Sat Oct 29 09:05:56 2016] [error] [client 1.129.97.116] PHP Fatal error: require_once(): Failed opening required ‘http://www.itgroup.net.au/php/config.php&#8217; (include_path=’.:/usr/share/pear:/usr/share/php’) in /home/itgroup/public_html/php/contact.php on line 3, referer: http://www.itgroup.net.au/
    [Sat Oct 29 09:05:57 2016] [error] [client 1.129.97.116] PHP Warning: require_once(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /home/itgroup/public_html/php/contact.php on line 3, referer: http://www.itgroup.net.au/
    [Sat Oct 29 09:05:57 2016] [error] [client 1.129.97.116] PHP Warning: require_once(http://www.itgroup.net.au/php/config.php): failed to open stream: no suitable wrapper could be found in /home/itgroup/public_html/php/contact.php on line 3, referer: http://www.itgroup.net.au/
    [Sat Oct 29 09:05:57 2016] [error] [client 1.129.97.116] PHP Fatal error: require_once(): Failed opening required ‘http://www.itgroup.net.au/php/config.php&#8217; (include_path=’.:/usr/share/pear:/usr/share/php’) in /home/itgroup/public_html/php/contact.php on line 3, referer: http://www.itgroup.net.au/
    [Sat Oct 29 09:05:59 2016] [error] [client 1.129.97.116] PHP Warning: require_once(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /home/itgroup/public_html/php/contact.php on line 3, referer: http://www.itgroup.net.au/
    [Sat Oct 29 09:05:59 2016] [error] [client 1.129.97.116] PHP Warning: require_once(http://www.itgroup.net.au/php/config.php): failed to open stream: no suitable wrapper could be found in /home/itgroup/public_html/php/contact.php on line 3, referer: http://www.itgroup.net.au/
    [Sat Oct 29 09:05:59 2016] [error] [client 1.129.97.116] PHP Fatal error: require_once(): Failed opening required ‘http://www.itgroup.net.au/php/config.php&#8217; (include_path=’.:/usr/share/pear:/usr/share/php’) in /home/itgroup/public_html/php/contact.php on line 3, referer: http://www.itgroup.net.au/
    [Sat Oct 29 09:06:00 2016] [error] [client 1.129.97.116] PHP Warning: require_once(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /home/itgroup/public_html/php/contact.php on line 3, referer: http://www.itgroup.net.au/
    [Sat Oct 29 09:06:00 2016] [error] [client 1.129.97.116] PHP Warning: require_once(http://www.itgroup.net.au/php/config.php): failed to open stream: no suitable wrapper could be found in /home/itgroup/public_html/php/contact.php on line 3, referer: http://www.itgroup.net.au/
    [Sat Oct 29 09:06:00 2016] [error] [client 1.129.97.116] PHP Fatal error: require_once(): Failed opening required ‘http://www.itgroup.net.au/php/config.php&#8217; (include_path=’.:/usr/share/pear:/usr/share/php’) in /home/itgroup/public_html/php/contact.php on line 3, referer: http://www.itgroup.net.au/

    Last lines of Only show lines with text

    <- Return to system logs

    #5543
    CreaboxThemes
    Keymaster

    Hi,

    could you contact to your server provider for this error? It is an internal server error. I don’t know where it is the problem. They help you better.

    Anyway, change the previous option type: “GET” to type: “POST” in the file scripts.js and try it.

    Regards

    #5544
    Steve
    Participant

    i have contacted provider – no help there at all. I have put the path back and also the contact form, and now I am getting message_body_error on the form when I press send.
    The logs show:
    Sat Oct 29 20:57:05 2016] [error] [client 1.129.97.116] PHP Notice: Use of undefined constant TEMPLATE_PATH – assumed ‘TEMPLATE_PATH’ in /home/itgroup/public_html/php/contact.php on line 30, referer: http://www.itgroup.net.au/
    [Sat Oct 29 20:57:05 2016] [error] [client 1.129.97.116] PHP Warning: include(TEMPLATE_PATH): failed to open stream: No such file or directory in /home/itgroup/public_html/php/contact.php on line 30, referer: http://www.itgroup.net.au/
    [Sat Oct 29 20:57:05 2016] [error] [client 1.129.97.116] PHP Warning: include(TEMPLATE_PATH): failed to open stream: No such file or directory in /home/itgroup/public_html/php/contact.php on line 30, referer: http://www.itgroup.net.au/
    [Sat Oct 29 20:57:05 2016] [error] [client 1.129.97.116] PHP Warning: include(): Failed opening ‘TEMPLATE_PATH’ for inclusion (include_path=’.:/usr/share/pear:/usr/share/php’) in /home/itgroup/public_html/php/contact.php on line 30, referer: http://www.itgroup.net.au/
    [Sat Oct 29 20:57:05 2016] [error] [client 1.129.97.116] PHP Notice: Use of undefined constant SMTP_HOST – assumed ‘SMTP_HOST’ in /home/itgroup/public_html/php/contact.php on line 40, referer: http://www.itgroup.net.au/
    [Sat Oct 29 20:57:05 2016] [error] [client 1.129.97.116] PHP Notice: Use of undefined constant SMTP_USERNAME – assumed ‘SMTP_USERNAME’ in /home/itgroup/public_html/php/contact.php on line 42, referer: http://www.itgroup.net.au/
    [Sat Oct 29 20:57:05 2016] [error] [client 1.129.97.116] PHP Notice: Use of undefined constant SMTP_PASSWORD – assumed ‘SMTP_PASSWORD’ in /home/itgroup/public_html/php/contact.php on line 43, referer: http://www.itgroup.net.au/
    [Sat Oct 29 20:57:05 2016] [error] [client 1.129.97.116] PHP Notice: Use of undefined constant SUBJECT – assumed ‘SUBJECT’ in /home/itgroup/public_html/php/contact.php on line 45, referer: http://www.itgroup.net.au/
    [Sat Oct 29 20:57:05 2016] [error] [client 1.129.97.116] PHP Notice: Use of undefined constant MSG_SEND_ERROR – assumed ‘MSG_SEND_ERROR’ in /home/itgroup/public_html/php/contact.php on line 58, referer: http://www.itgroup.net.au/

    Last lines of Only show lines with text

    <- Return to system logs

Viewing 15 posts - 1 through 15 (of 22 total)
  • You must be logged in to reply to this topic.