Blocs 6 Form is not workingโฆ
Update from my Hosting provider:
โCurrently, your website Form is trying to send emails without any SMTP authentication which is the reason for rejecting the emails by Gmail and other service providers.โ
How do I get Blocs to add SMTP authentication in the exported script?
When I try the email form I get the green announcement saying it was successfully sent. I am not sure what to do at this point.
What is wrong with the following?
Inside the PHP file
<?php
if (empty($_POST['name_2024']) && strlen($_POST['name_2024']) == 0 || empty($_POST['phone_2024']) && strlen($_POST['phone_2024']) == 0 || empty($_POST['email_2024']) && strlen($_POST['email_2024']) == 0)
{
return false;
}
$name_2024 = $_POST['name_2024'];
$phone_2024 = $_POST['phone_2024'];
$email_2024 = $_POST['email_2024'];
$message_2024 = $_POST['message_2024'];
$optin6 = $_POST['optin6'];
// Create Message
$to = 'info@gmail.com,info@domain.com';
$email_subject = "Message from prospect";
$email_body = "You have received a new message. \n\nName_2024: $name_2024 \nPhone_2024: $phone_2024 \nEmail_2024: $email_2024 \nMessage_2024: $message_2024 \nOptin6: $optin6 \n";
$headers = "MIME-Version: 1.0\r\nContent-type: text/plain; charset=UTF-8\r\n";
$headers .= "From: info@gmail.com\r\n";
$headers .= "Reply-To: $email_2024";
// Post Message
if (function_exists('mail'))
{
$result = mail($to,$email_subject,$email_body,$headers);
}
else // Mail() Disabled
{
$error = array("message" => "The php mail() function is not available on this server.");
header('Content-Type: application/json');
http_response_code(500);
echo json_encode($error);
}
?>

