<?php
echo $this->Form->end(__('Submit'))
$to = "someone@hotmail.com"; $subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "someonelse@example.com";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>
Hey guys need help here! I want when someone pressed the submit button, it saves and sends the details entered to the emails
You have to use like this.Make sure your button type is submit
If you are still running WAMPServer then you are on a Windows PC.
Window does not come with a mail server, and the
mail()
function does little else other than pass a mail onto a mail server.You will either need to install a mail server, they do exist for windows, but this is not a simple task for a beginner.
Alternatively, look at
phpMailer
which can be used to send mail and basically piggy backs an existing email account like one of your yahoo or gmail accountsTry the below code,