Ask coding questions

← Back to all posts
Sending Emails on a website, and including php files in adobe dreamweaver
SilvrgunSuprman (1)

Hello Replit!

For my school project I need to make a website and I decided to make one for my mum's business. I have made a contact popup but I now need to actually send emails from that popup. I went on youtube and found a solution which is a php file. I am suing adobe dreamweaver and when i make a php file it asks me to set up some kind of server??? So I don't think the php is doing anything. Here is the php code

<?php

	$name = $_POST['name'];
	$visitor_email = $POST['email'];
	$message = $_POST['message'];
	$message_subject = $_POST['subject'];

	$email_from = "Moore Weir'd Knots & Pots Website";
	$email_subject = $message_subject;
	$email_body = "User Name: $name.\n".
					"User Email: $visitor_email.\n".
						"User Message: $message.\n";
	
	$to = "[email protected]";
	$headers = "From: $email_from \r\n";
	$headers .="Reply-To: $visitor_email \r\n";
	
	mail($to,$email_subject,$email_body,$headers);
	header("Location: Moore Weir'd Knots & Pots")

?>
Comments
hotnewtop
InvisibleOne (2975)

Yes, to send an email on the web it has to be from a server, at least I don't know of a way to send it from the front end.