adding SSL to php contact form

A

Anonymous

Guest
Hi all,

I have recently added SSL to my website and since then my contact form is not working. I contacting the admin who told me that I need to configure the form using the mail settings below however I am unsure how were to add them to my form. Any help would be appreciated.

Outgoing mail server: uk41.siteground.eu
Outgoing port: 465

Code:
<?php 
$errors = '';
$myemail = 'info@example.com';

  if(empty($_POST['name'])  || 
           empty($_POST['email']) || 
           empty($_POST['message'])) {
        $errors = 'Please enter all required fields';
    }
    else
    {
     $name = $_POST['name']; 
     $email = $_POST['email']; 
     $message = $_POST['message'];
   } 

if( empty($errors))
{
	$to = $myemail; 
	$email_subject = "Website Query: $name";
	$email_body = "You have received a new message. ".
	" Here are the details:\n Name: $name \n Email: $email \n Message \n $message"; 
	
	$headers = "From: $myemail\n"; 
	$headers .= "Reply-To: $email";
	
	mail($to,$email_subject,$email_body,$headers);
	//redirect to the 'thank you' page
	header('Location: thanks.html');
} 
?>
 
Back
Top