adding SSL to php contact form

the mail() function

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 2
Joined: Mon Jan 22, 2018 4:06 am

Mon Jan 22, 2018 4:12 am

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:
Outgoing port: 465

Code: Select all

$errors = '';
$myemail = '';

  if(empty($_POST['name'])  || 
           empty($_POST['email']) || 
           empty($_POST['message'])) {
        $errors = 'Please enter all required fields';
     $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";
	//redirect to the 'thank you' page
	header('Location: thanks.html');
Post Reply