I need help with a few things :)

20 replies · opened Mar 29, 2018

CcoconghaileMar 29, 2018

First off....I love your template. It's excellent. I just have a few questions and a few things I'm finding difficult.

1... My contact form seems to just sit there doing nothing when I press send. I get no error. This is the link. I followed the steps but I'm getting no joy. The action call....should it link to the exact location of the sendemail.php file i.e. http://domain-name.ie/parent/child/include/sendemail.php?

2... I've disabled the Recaptcha for now as I want to sort the form first but can I ask, what do i need to do on my server side as I'm getting the error 'Recaptcha not Valiadted'

If you could help me with this I'd really appreciate it.

SSemicolon WebSTAFFApr 4, 2018

Hello,

  1. We have checked out your Website and the http://www.antoireachtas.ie/assets/new/include/sendemail.php returns a 500 internal Server Error. There appears to be some issue with the Server Configuration which is causing this issue. Please consider contacting your Web Hosting Provider regarding this or turn on Error Reporting in the PHP.ini File to display the exact errors.

  2. Make sure that the allow_url_fopen is enabled in the PHP.ini Configuration File so that the reCaptcha Verification works correctly.

Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

CcoconghaileApr 4, 2018

I'll ask my provider to look into it now. Quick question...is my action call right?

SSemicolon WebSTAFFApr 5, 2018

Hello,

Yes, your action call is perfectly fine.

Do let us know if we can help you with anything else or if you find any further issues with Canvas.

CcoconghaileApr 6, 2018

Hi SemiColonWeb Team,

I sent this message to my hosting provider after our last correspondence.

_**"1. We have checked out your Website and the http://www.antoireachtas.ie/assets/new/include/sendemail.php returns a 500 internal Server Error. There appears to be some issue with the Server Configuration which is causing this issue. Please consider contacting your Web Hosting Provider regarding this or turn on Error Reporting in the PHP.ini File to display the exact errors. - Are there any errors in the PHP.ini file?

  1. Make sure that the allow_url_fopen is enabled in the PHP.ini Configuration File so that the reCaptcha Verification works correctly. - Can you make sure this is enabled."**_

and below is the answers they gave.

_**"1) The use of allow_url_fopen is not supported on our Apache shared hosting platform. Consider using cURL instead.

  1. The path to Sendmail is /usr/sbin/sendmail

  2. Your mail form should set a valid From address at the domain that it is sending emails from."**_

Does this make sense to you?

SSemicolon WebSTAFFApr 6, 2018

Hello,

Thanks for the heads up!

  1. Find the following code in the include/sendemail.php File:
// Runs only when reCaptcha is present in the Contact Form
if( isset( $_POST['g-recaptcha-response'] ) ) {
	$recaptcha_response = $_POST['g-recaptcha-response'];
	$response = file_get_contents( "https://www.google.com/recaptcha/api/siteverify?secret=" . $recaptcha_secret . "&response=" . $recaptcha_response );

	$g_response = json_decode( $response );

	if ( $g_response->success !== true ) {
		echo '{ "alert": "error", "message": "Captcha not Validated! Please Try Again." }';
		die;
	}
}

and replace it with:

// Runs only when reCaptcha is present in the Contact Form
if( isset( $_POST['g-recaptcha-response'] ) ) {

	$recaptcha_data = array(
						'secret' => $recaptcha_secret,
						'response' => $_POST['g-recaptcha-response']
					);

	$recap_verify = curl_init();
	curl_setopt($recap_verify, CURLOPT_URL, "https://www.google.com/recaptcha/api/siteverify");
	curl_setopt($recap_verify, CURLOPT_POST, true);
	curl_setopt($recap_verify, CURLOPT_POSTFIELDS, http_build_query( $recaptcha_data ));
	curl_setopt($recap_verify, CURLOPT_SSL_VERIFYPEER, false);
	curl_setopt($recap_verify, CURLOPT_RETURNTRANSFER, true);
	$recap_response = curl_exec($recap_verify);

	$g_response = json_decode( $recap_response );

	if ( $g_response->success !== true ) {
		echo '{ "alert": "error", "message": "Captcha not Validated! Please Try Again." }';
		die;
	}
}
  1. Find the following code in the include/sendemail.php File:
$mail->SetFrom( $email , $name );

and change it to:

$mail->SetFrom( 'user@antoireachtas.ie' , 'Your Name' );

This should definitely fix the issues. Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

CcoconghaileApr 9, 2018

I'm still getting an error. When I inspect errors I get this error: Failed to load resource: http://www.antoireachtas.ie/assets/new/include/sendemail.php - the server responded with a status of 500 (Internal Server Error)

Here is the HTML code:

<div class="nobottommargin">
<div class="contact-widget">
<div class="contact-form-result"></div>
<form class="nobottommargin" id="template-contactform" name="template-contactform" action="http://www.antoireachtas.ie/assets/new/include/sendemail.php" method="post">
<div class="form-process"></div>
<div class="col_half">
<label for="template-contactform-name">Ainm</label>
<input type="text" id="template-contactform-name" name="template-contactform-name" value="" class="sm-form-control required" />
</div>
<div class="col_half col_last">
<label for="template-contactform-surname">Sloinne</label>
<input type="text" id="template-contactform-surname" name="template-contactform-surname" value="" class="sm-form-control required" />
</div>
<div class="clear"></div>
<div class="col_half">
<label for="template-contactform-email">Ríomhphost</label>
<input type="email" id="template-contactform-email" name="template-contactform-email" value="" class="required email sm-form-control" />
</div>
<div class="col_half col_last">
<label for="template-contactform-phone">Fón</label>
<input type="text" id="template-contactform-phone" name="template-contactform-phone" value="" class="sm-form-control required" />
</div>
<div class="clear"></div>
<div class="col_full">
<label for="template-contactform-subject">Ábhar</label>
<input type="text" id="template-contactform-subject" name="template-contactform-subject" value="" class="sm-form-control" />
</div>
<div class="col_full">
<label for="template-contactform-message">Teachtaireacht</label>
<textarea class="required sm-form-control" id="template-contactform-message" name="template-contactform-message" rows="8" cols="30"></textarea>
</div>
<div class="col_full hidden">
<input type="text" id="template-contactform-botcheck" name="template-contactform-botcheck" value="" class="sm-form-control" />
</div>
<!-- <div class="col_full">
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<div class="g-recaptcha" data-sitekey="6LesC0kUAAAAAP5DBrFjfg-oLJHM3Xo12eK2c1Zc"></div>
</div> -->
<div class="col_full center">
<button class="button button-3d nomargin" type="submit" id="template-contactform-submit" name="template-contactform-submit" value="submit">Seol Teachtaireacht</button>
</div>
</form>
</div>
</div>

And here is the include.php code:

<?php

use PHPMailer\PHPMailer\PHPMailer;

require 'phpmailer/src/PHPMailer.php';
require 'phpmailer/src/SMTP.php';

$toemails = array();

$toemails[] = array(
'email' => 'colin@antoireachtas.ie', // Your Email Address
'name' => 'Colin O Conghaile' // Your Name
);

// Form Processing Messages
$message_success = 'We have successfully received your Message and will get Back to you as soon as possible.';

// Add this only if you use reCaptcha with your Contact Forms
$recaptcha_secret = '6LesC0kUAAAAAAaOFkC1IoD90oubs42aVipHNxNN'; // Your reCaptcha Secret

// If you intend you use SMTP, add your SMTP Code after this Line
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "smtp.gmail.com";
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->Port = 465;
$mail->Username = "colin@antoireachtas.ie";
$mail->Password = "Baile2018";

if( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
if( $_POST['template-contactform-email'] != '' ) {

	$name = isset( $_POST['template-contactform-name'] ) ? $_POST['template-contactform-name'] : '';
	$surname = isset( $_POST['template-contactform-surname'] ) ? $_POST['template-contactform-surname'] : '';
$email = isset( $_POST['template-contactform-email'] ) ? $_POST['template-contactform-email'] : '';
	$phone = isset( $_POST['template-contactform-phone'] ) ? $_POST['template-contactform-phone'] : '';
	$subject = isset( $_POST['template-contactform-subject'] ) ? $_POST['template-contactform-subject'] : '';
	$message = isset( $_POST['template-contactform-message'] ) ? $_POST['template-contactform-message'] : '';

	$subject = isset($subject) ? $subject : 'New Message From Contact Form';

	$botcheck = $_POST['template-contactform-botcheck'];

	if( $botcheck == '' ) {

		$mail-&gt;SetFrom( 'colin@antoireachtas.ie' , 'Colin Ó Conghaile' );
		$mail-&gt;AddReplyTo( $email , $name );
		foreach( $toemails as $toemail ) {
			$mail-&gt;AddAddress( $toemail['email'] , $toemail['name'] );
		}
		$mail-&gt;Subject = $subject;

		$name = isset($name) ? "Name: $name&lt;br&gt;&lt;br&gt;" : '';
  $surname = isset($surname) ? "Surname: $surname&lt;br&gt;&lt;br&gt;" : '';
		$email = isset($email) ? "Email: $email&lt;br&gt;&lt;br&gt;" : '';
		$phone = isset($phone) ? "Phone: $phone&lt;br&gt;&lt;br&gt;" : '';
		$message = isset($message) ? "Message: $message&lt;br&gt;&lt;br&gt;" : '';

		$referrer = $_SERVER['HTTP_REFERER'] ? '&lt;br&gt;&lt;br&gt;&lt;br&gt;This Form was submitted from: ' . $_SERVER['HTTP_REFERER'] : '';

		$body = "$name $surname $email $phone $message $referrer";

		// Runs only when File Field is present in the Contact Form
		if ( isset( $_FILES['template-contactform-file'] ) && $_FILES['template-contactform-file']['error'] == UPLOAD_ERR_OK ) {
			$mail-&gt;IsHTML(true);
			$mail-&gt;AddAttachment( $_FILES['template-contactform-file']['tmp_name'], $_FILES['template-contactform-file']['name'] );
		}

		// Runs only when reCaptcha is present in the Contact Form
  if( isset( $_POST['g-recaptcha-response'] ) ) {
   
      $recaptcha_data = array(
          'secret' =&gt; $recaptcha_secret,
          'response' =&gt; $_POST['g-recaptcha-response']
      );
   
      $recap_verify = curl_init();
      curl_setopt($recap_verify, CURLOPT_URL, "https://www.google.com/recaptcha/api/siteverify");
      curl_setopt($recap_verify, CURLOPT_POST, true);
      curl_setopt($recap_verify, CURLOPT_POSTFIELDS, http_build_query( $recaptcha_data ));
      curl_setopt($recap_verify, CURLOPT_SSL_VERIFYPEER, false);
      curl_setopt($recap_verify, CURLOPT_RETURNTRANSFER, true);
      $recap_response = curl_exec($recap_verify);
   
      $g_response = json_decode( $recap_response );
   
      if ( $g_response-&gt;success !== true ) {
          echo '{ "alert": "error", "message": "Captcha not Validated! Please Try Again." }';
          die;
      }
  }

		// Uncomment the following Lines of Code if you want to Force reCaptcha Validation

		 // if( !isset( $_POST['g-recaptcha-response'] ) ) {
		 	// echo '{ "alert": "error", "message": "Captcha not Submitted! Please Try Again." }';
		 	// die;
		 // }

		$mail-&gt;MsgHTML( $body );
		$sendEmail = $mail-&gt;Send();

		if( $sendEmail == true ):
			echo '{ "alert": "success", "message": "' . $message_success . '" }';
		else:
			echo '{ "alert": "error", "message": "Email **could not** be sent due to some Unexpected Error. Please Try Again later.&lt;br /&gt;&lt;br /&gt;**Reason:**&lt;br /&gt;' . $mail-&gt;ErrorInfo . '" }';
		endif;
	} else {
		echo '{ "alert": "error", "message": "Bot **Detected**.! Clean yourself Botster.!" }';
	}
} else {
	echo '{ "alert": "error", "message": "Please **Fill up** all the Fields and Try Again." }';
}

} else {
echo '{ "alert": "error", "message": "An unexpected error occured. Please Try Again later." }';
}

?>

SSemicolon WebSTAFFApr 9, 2018

Hello,

Can you please provide us with your FTP Login Details in a Private Reply so that we can look further into this. Thanks for your Patience.

Meanwhile, do let us know if we can help you with anything else or if you find any further issues with Canvas.

CcoconghaileApr 9, 2018

I can do that no problem but I'll need your IP address to add it to the list of Allowed IP Addresses

CcoconghaileApr 10, 2018

I have granted access to all IP addressees for 24 hours. It's the longest I can give without knowing the IP Address of a specific computer.

My FTP Details:

Host: ftp1.reg365.net
UN: antoireachtas.ie
PW: 01Rftp3achta5

SSemicolon WebSTAFFApr 13, 2018

Hello,

Thanks for the Access!

We have gone through your Files and tried to determine the issue. The issue appears to be with the SMTP. We have made the necessary code changes and fixed this issue. Please let us know if you need any further assistance with this. Thanks for your Patience.

Meanwhile, do let us know if we can help you with anything else or if you find any further issues with Canvas.

CcoconghaileApr 13, 2018

I got the emails in there. Thank you so much guys. I really appreciate it. Congrats on a fantastic product.

One last question....am I able to create another form with more inputs? I need to create a form that collects more information. Would I just copy the sendemail.php file and rename it and change that name then on the HTML?

CcoconghaileApr 13, 2018

Sorry...another thing. I've added the Recaptcha to the form now (http://www.antoireachtas.ie/teagmhail/baile-atha-cliath.html) and it's starting to grey out again. I've added the Site Key and the Secret Key I set up under my email address. The FTP details are the same if you need to log in.

SSemicolon WebSTAFFApr 18, 2018

Hello,

Thanks for your Patience!

We have tried accessing your FTP but unfortunately, it is really confusing since the exact location of the Files are hidden. Can you please point us where to find this file: teagmhail/gaillimh.html ?

Meanwhile, let us know if we can help you with anything else or if you find any further issues with Canvas.

CcoconghaileApr 19, 2018

I'm using a CMS called ModX Revolution. The HTML won't be visible in the FTP. I had to create templates that can be used on multiple pages. Here is the code for the teagmhail/gaillimh.html page.


  
    
    
    
  	
  
  	
  	
- 
  	
- 
  	
- 
  	
- 
  	
- 
  	
- 
  	
- 
  
  	
- 
    
- 
  	
  
  	
  	[[*pagetitle]] | Teagmháil | An tOireachtas
    
    
    
    
- 
    
- 
    
- 
    
- 
    
- 
    
- 
    
- 
    
- 
    
- 
    
- 
    
- 
    
- 
    
- 
    
- 
    
    
    
  
  

  
  	
  		
  			
  				
  					
  						
  							
- [Baile Átha Cliath](http://www.antoireachtas.ie/teagmhail/baile-atha-cliath.html)
  							
- [Gaillimh](http://www.antoireachtas.ie/teagmhail/gaillimh.html)
  							
- [An tIúr](http://www.antoireachtas.ie/teagmhail/an-tiur.html)
  							
- [Teagmháil](http://www.antoireachtas.ie/teagmhail/)
								  
      							
- [ Baile Átha Cliath +353 (01) 475 3857](tel:+35314753857)
                    
- [ Gaillimh +353 (091) 572 545](tel:+35391572545)
                    
- [ An tIúr +44 (028) 3025 7812](tel:+442830257812)
      							
  							
  						
  					
  				
  				
  					
  						
  							
- [](https://www.facebook.com/oireachtas.nagaeilge/)
  							
- [](https://twitter.com/oirnagaeilge)
                
- [](https://www.instagram.com/oirnagaeilge/)
  							
- [](https://plus.google.com/105222783327700460097)
  							
- [](https://ie.linkedin.com/company/oireachtas-na-gaeilge)  							
  							
- [](tel:+35314753857)
  							
- [](mailto:eolas@antoireachtas.ie)
  						
  					
  				
  			
  		
      
      
  			
  				
  					
  
  					
  						[
![attachment]([[++site_url]]assets/new/images/logo/logo-antoireachtas-v3-1.png)
]([[++site_url]])
  						[
![attachment]([[++site_url]]assets/new/images/logo/logo-antoireachtas-v3-1.png)
]([[++site_url]])
  					
  
  					
              [[Wayfinder? 
                &startId=`0` 
                &level=`4` 
                &outerTpl=`outerTpl` 
                &rowTpl=`rowTpl` 
                &activeParentRowTpl=`activeParentRowTpl` 
                &parentRowTpl=`parentRowTpl` 
                &innerTpl=`innerTpl` 
                &innerRowTpl=`innerRowTpl` 
                &firstClass=`` 
                &lastClass=`` 
                &removeNewLines=`1`
              ]]

  						
  						
  							[](#)
  							
  								
  							
  						  
  					
  				
  			
  		
      
      
  			
  				[[*pagetitle]]
  				Teagmháil | An tOireachtas
  				
  					
- [Home](#)
  					
- [Teagmháil](#)
  					
- [[*pagetitle]]
  				
  			  
  			  
  		
      
      
  			
  				
  					Oifigí an Oireachtais
  					
              [[Wayfinder? 
                &startId=`16` 
                &level=`1` 
                &outerTpl=`outerTpl` 
                &rowTpl=`rowTpl` 
                &activeParentRowTpl=`activeParentRowTpl` 
                &parentRowTpl=`parentRowTpl` 
                &innerTpl=`innerTpl` 
                &innerRowTpl=`innerRowTpl` 
                &firstClass=`` 
                &lastClass=`` 
                &removeNewLines=`1`
              ]]
  					
  					
  				
  			
  		
      
			
				
          [[$advertisement_TopCarousel_Feed]]
        
      
                  
      
  			
  				              
            
  						
              
    						
    							
    							
    								 
    								
    									Ainm
    									
    								
                    
    									Sloinne
    									
    								
                         
    								
    									R&iacute;omhphost
    									
    								  
    								
    									F&oacute;n
    									
    								      
    								
                    
    									Ábhar
    									
    								 
    								
    									Teachtaireacht
    									
    								 
    								
    									
    								
                    
    									
    									   
    								    
    								
    									Seol Teachtaireacht
    								 
    							
    						
    					
              
            
            
              [[*content]]
              
              [[$advertisement_Carousel_Feed]]
            
                     
          
        
  		
  
  		
  		[[$footer]]
  	
  
  	
  	
  
  	
  	
  	
  	
  	
  
  	
  	
    
    
  		jQuery('#page-title-gmap').gMap({
  			address: '[[*new_Address_Google_Maps]]',
  			maptype: 'ROADMAP',
  			zoom: 15,
  			markers: [
  				{
  					address: "[[*new_Address_Google_Maps]]",
  					html: 'Dia dhuit, is muide An tOireachtas
 Is ceanneagraíocht anois é Oireachtas na Gaeilge átá tiomanta do dheiseanna úsáidte Gaeilge agus do bhunú gréasáin úsáidte Gaeilge.
',
    				icon: {
  						image: "[[++site_url]]assets/new/images/icons/map-icon-oir.png",
  						iconsize: [32, 39],
  						iconanchor: [13,39]
  					}
  				}
  			],
  			doubleclickzoom: false,
  			controls: {
  				panControl: true,
  				zoomControl: true,
  				mapTypeControl: true,
  				scaleControl: false,
  				streetViewControl: false,
  				overviewMapControl: false
  			},
            styles: [{"featureType":"all","elementType":"labels.text.fill","stylers":[{"saturation":36},{"color":"#000000"},{"lightness":40}]},{"featureType":"all","elementType":"labels.text.stroke","stylers":[{"visibility":"on"},{"color":"#000000"},{"lightness":16}]},{"featureType":"all","elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"featureType":"administrative","elementType":"geometry.fill","stylers":[{"color":"#000000"},{"lightness":20}]},{"featureType":"administrative","elementType":"geometry.stroke","stylers":[{"color":"#000000"},{"lightness":17},{"weight":1.2}]},{"featureType":"administrative","elementType":"labels","stylers":[{"visibility":"off"}]},{"featureType":"administrative.country","elementType":"all","stylers":[{"visibility":"simplified"}]},{"featureType":"administrative.country","elementType":"geometry","stylers":[{"visibility":"simplified"}]},{"featureType":"administrative.country","elementType":"labels.text","stylers":[{"visibility":"simplified"}]},{"featureType":"administrative.province","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"administrative.locality","elementType":"all","stylers":[{"visibility":"simplified"},{"saturation":"-100"},{"lightness":"30"}]},{"featureType":"administrative.neighborhood","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"administrative.land_parcel","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"landscape","elementType":"all","stylers":[{"visibility":"simplified"},{"gamma":"0.00"},{"lightness":"74"}]},{"featureType":"landscape","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":20}]},{"featureType":"landscape.man_made","elementType":"all","stylers":[{"lightness":"3"}]},{"featureType":"poi","elementType":"all","stylers":[{"visibility":"off"}]},{"featureType":"poi","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":21}]},{"featureType":"road","elementType":"geometry","stylers":[{"visibility":"simplified"}]},{"featureType":"road.highway","elementType":"geometry.fill","stylers":[{"color":"#000000"},{"lightness":17}]},{"featureType":"road.highway","elementType":"geometry.stroke","stylers":[{"color":"#000000"},{"lightness":29},{"weight":0.2}]},{"featureType":"road.arterial","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":18}]},{"featureType":"road.local","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":16}]},{"featureType":"transit","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":19}]},{"featureType":"water","elementType":"geometry","stylers":[{"color":"#000000"},{"lightness":17}]}]
        });
  	 
  
CcoconghaileApr 25, 2018

The issue is with my hosting provider. They don't support url_fopen. This is the reply they gave me.

Thanks for getting back to us. url_fopen isn't available on apache shared hosting. You'd only be able to have this feature using cPanel web hosting or a vps/dedicated server.

It's a pity as I'm getting hundreds of spam

CcoconghaileMay 2, 2018

Hey Guys,

I got THE Recaptcha sorted and it's working perfectly. Thanks a million for all your help. I really appreciate it. I have one last question (I hope). I'm receiving the emails perfectly but the email address that it apparently comes from is my own email address. Does this make sense? It comes in like this below: The from email is my own and not the one people enter. I've also added the code I'm using to connect.

from: Colm Gaeilge <eolas@antoireachtas.ie> - SHOULDN'T THIS ALSO BE THE EMAIL THEY ENTER
reply-to: Colm Gaeilge <diadhuit@gaeilge.ie>
to: Eolas An tOireachtas <eolas@antoireachtas.ie>
date: 2 May 2018 at 14:17
subject: Teachtaireacht | Foirm Baile an Oireachtais
mailed-by: antoireachtas.ie

 'eolas@antoireachtas.ie', // Your Email Address
				'name' => 'Eolas An tOireachtas' // Your Name
			);

// Form Processing Messages
$message_success = 'Go raibh m&iacute;le maith agat as ucht do **theachtaireacht**. Beidh ball den fhoireann i dteagmh&aacute;il leat go luath.';

// Add this only if you use reCaptcha with your Contact Forms
$recaptcha_secret = '6LesC0kUAAAAAAaOFkC1IoD90oubs42aVipHNxNN'; // Your reCaptcha Secret

// If you intend you use SMTP, add your SMTP Code after this Line
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->CharSet = "UTF-8";
$mail->Host = "smtp.gmail.com";
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->Username = "eolas@antoireachtas.ie";
$mail->Password = "iolar3857";

if( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
	if( $_POST['template-contactform-email'] != '' ) {

		$name = isset( $_POST['template-contactform-name'] ) ? $_POST['template-contactform-name'] : '';
    $email = isset( $_POST['template-contactform-email'] ) ? $_POST['template-contactform-email'] : '';
		$phone = isset( $_POST['template-contactform-phone'] ) ? $_POST['template-contactform-phone'] : '';
		$message = isset( $_POST['template-contactform-message'] ) ? $_POST['template-contactform-message'] : '';

		$subject = isset($subject) ? $subject : 'Teachtaireacht | Foirm Baile an Oireachtais';

		$botcheck = $_POST['template-contactform-botcheck'];

		if( $botcheck == '' ) {

			$mail->SetFrom( $email , $name );
			$mail->AddReplyTo( $email , $name );
			foreach( $toemails as $toemail ) {
				$mail->AddAddress( $toemail['email'] , $toemail['name'] );
			}
			$mail->Subject = $subject;

			$name = isset($name) ? "Ainm: $name

" : '';
			$email = isset($email) ? "R&iacute;omhphoist: $email

" : '';
			$phone = isset($phone) ? "F&oacute;n: $phone

" : '';
			$message = isset($message) ? "Teachtaireacht: $message

" : '';

			$referrer = $_SERVER['HTTP_REFERER'] ? '

Th&aacute;inig an teachtaireacht seo &oacute;: ' . $_SERVER['HTTP_REFERER'] : '';

			$body = "$name $email $phone $message $referrer";

			// Runs only when File Field is present in the Contact Form
			if ( isset( $_FILES['template-contactform-file'] ) && $_FILES['template-contactform-file']['error'] == UPLOAD_ERR_OK ) {
				$mail->IsHTML(true);
				$mail->AddAttachment( $_FILES['template-contactform-file']['tmp_name'], $_FILES['template-contactform-file']['name'] );
			}

			// Runs only when reCaptcha is present in the Contact Form
      if( isset( $_POST['g-recaptcha-response'] ) ) {
       
          $recaptcha_data = array(
              'secret' => $recaptcha_secret,
              'response' => $_POST['g-recaptcha-response']
          );
       
          $recap_verify = curl_init();
          curl_setopt($recap_verify, CURLOPT_URL, "https://www.google.com/recaptcha/api/siteverify");
          curl_setopt($recap_verify, CURLOPT_POST, true);
          curl_setopt($recap_verify, CURLOPT_POSTFIELDS, http_build_query( $recaptcha_data ));
          curl_setopt($recap_verify, CURLOPT_SSL_VERIFYPEER, false);
          curl_setopt($recap_verify, CURLOPT_RETURNTRANSFER, true);
          $recap_response = curl_exec($recap_verify);
       
          $g_response = json_decode( $recap_response );
       
          if ( $g_response->success !== true ) {
              echo '{ "alert": "error", "message": "N&iacute;or deimhn&iacute;odh an Captcha! Triail ar&iacute;s ar ball &eacute;, le do thoil." }';
              die;
          }
      }

			// Uncomment the following Lines of Code if you want to Force reCaptcha Validation

			 // if( !isset( $_POST['g-recaptcha-response'] ) ) {
			 	// echo '{ "alert": "error", "message": "Captcha not Submitted! Please Try Again." }';
			 	// die;
			 // }

			$mail->MsgHTML( $body );
			$sendEmail = $mail->Send();

			if( $sendEmail == true ):
				echo '{ "alert": "success", "message": "' . $message_success . '" }';
			else:
				echo '{ "alert": "error", "message": "N&iacute;orbh f&eacute;idir r&iacute;omhphost a sheoladh ar ch&uacute;is &eacute;igin. Triail ar&iacute;s ar ball &eacute;, le do thoil.

**F&aacute;th:**
' . $mail->ErrorInfo . '" }';
			endif;
		} else {
			echo '{ "alert": "error", "message": "Bot **Detected**.! Glan do Botster.!" }';
		}
	} else {
		echo '{ "alert": "error", "message": "L&iacute;on isteach an fhoirm ar fad, le do thoil, agus triail ar&iacute;s &eacute;." }';
	}
} else {
	echo '{ "alert": "error", "message": "Tharla fadhb gan choinne le d’ fhoirm. Triail ar&iacute;s ar ball &eacute;, le do thoil." }';
}

?>
SSemicolon WebSTAFFMay 7, 2018

Hello,

Really Glad this is solved for you now.

Some servers do not allow sending emails from unidentified addresses to prevent SPAM. They enforce sending emails from the same Domain.

Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

CcoconghaileMay 21, 2018

We're based in Europe so I need to be complying with GDPR. Do you have a GDPR Compliant Cookie Statement? Do you have a template to reject Cookies? Can the jquery.cookie.js in JavaScript Plugins be changed to be compliant?

CcoconghaileJun 18, 2018

I've set the Cookie Notification to my website but it doesn't come back after it expires. Is there something I'm doing wrong?

if( element.hasClass('enable-cookie') ) {
	var elementCookie = $.cookie( elementTargetValue, '1', { expires: 1 }, { path: '/' } );

	if( typeof elementCookie !== 'undefined' && elementCookie == '0' ) {
		return true;
	}
}
SSemicolon WebSTAFFJun 25, 2018

Hello,

Please use the following code instead:

if( element.hasClass('enable-cookie') ) {
    var elementCookie = $.cookie( elementTargetValue, '1', { expires: 1, path: '/' } );
 
    if( typeof elementCookie !== 'undefined' && elementCookie == '0' ) {
        return true;
    }
}

This should definitely work fine. Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard
I need help with a few things :) · Canvas Template Support