Form to retrieve email

I am trying to get a a contact form working to retrieve just a name and email. I used the bootstrap block but I dont get the info. How do I get it working? Isn’t it possible to just add the tag form action= "mailto:…@…com method=“post” /form somewhere? I know my why in HTML not CSS or PHP.

What happens when you test the form?

Also what email did you set within the php script? usually with hosting providers, the email has to be one associated with the domain of your hosting, for security/spam reasons, but the form works, I’ve used it in the past and never had any issue.

  `// Configuration option.
// Enter the email address that you want to emails to be sent to.
// Example $address = "yourname@yourdomain.com";

$address = "enter your email here";


// Configuration option.
// i.e. The standard subject will appear as, "You've been contacted by John Doe."

// Example, $e_subject = '$name . ' has contacted you via Your Website.';

$e_subject = 'You\'ve been contacted by ' . $name . '.';


// Configuration option.
// You can change this if you feel that you need to.
// Developers, you may wish to add more fields to the form, in which case you must be sure to add them here.

$e_body = "You have been contacted by $name from your website, their message is as follows." . PHP_EOL . PHP_EOL;
$e_content = "\"$comments\"" . PHP_EOL . PHP_EOL;
$e_reply = "You can contact $name by email, $email or by phone $phone";

$msg = wordwrap( $e_body . $e_content . $e_reply, 70 );

$headers = "From: $email" . PHP_EOL;
$headers .= "Reply-To: $email" . PHP_EOL;
$headers .= "MIME-Version: 1.0" . PHP_EOL;
$headers .= "Content-type: text/plain; charset=utf-8" . PHP_EOL;
$headers .= "Content-Transfer-Encoding: quoted-printable" . PHP_EOL;

if(mail($address, $e_subject, $msg, $headers)) {

	// Email has sent successfully, echo a success page.

	echo "<fieldset>";
	echo "<div id='success_page'>";
	echo "<h2><font color='black'>Email Sent Successfully.</h2></font>";
	echo "<p><font color='black'>Thank you <strong>$name</strong>, I will be in touch shortly.</p></font>";
	echo "</div>";
	echo "</fieldset>";

} else {

	echo 'ERROR!';

}`

That is part of the form that I edited, open up “contact-form.php” place your email here:

$address = “enter your email here”;

and you can adjust the font colour/size by changing the h2 and black as I added that in

2 Likes