๐—•๐—น๐—ผ๐—ฐ๐˜€ 6 ๐—ณ๐—ผ๐—ฟ๐—บ will work at SMTP info

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);
	}	
?>

Are you setting things up within the app properly for Forms SMTP in accordance with your hosting provider. As there should no longer be need to modify the PHP for SMTP, that was sometime ago.

Thanks for getting back to me. :slight_smile:
I just added the Form and filled it out. I did not see anything about SMTP. Is there something I am missing? I never did see that in the earlier versions. Is this something new?

It was first added in - Blocs 5.1.0 - July 3rd 2023
https://blocsapp.com/blocs5/release-notes/

Here is the SMTP Form documentation link again from above.

1 Like

I should have paid attention. I among to work on this tomorrow.

Thanks for hanging in there. :
smiley

2 Likes