Click here to Skip to main content
15,909,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
if(mail($to, $subject, $message, $headers)) {
echo json_encode(array('status' => 'success', 'message' => 'Your request has been recorded. Thank you.'));
} else {
$errorMessage="hello";
echo "alert('$errorMessage');";
echo json_encode(array('status' => 'failure', 'message' => 'Could not process your request. Please try again.'));
}

What I have tried:

i have tried it on local server and i don't know will it work on local server or not as i am new in php.
Posted
Comments
Richard MacCutchan 11-May-18 9:21am    
You need to send mail messages to a mail server. Do you have one running on your local system?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900