As noted in the comments, you haven’t closed off the $to
variable.
Set that to:
$to = '[email protected], [email protected]';
And change your mail()
function to:
if(!mail($to,$email_subject,$email_body)) {
echo 'failed';
} else {
echo 'sent';
}
You would get an error on the mail()
line because you had one too many commas (,
).
NOTE
The fourth 4
parameter is for your headers. (You didn’t include that in your script. So I didn’t add them, you can read the mail()
documentation to learn how to add them.)
3
solved Error in the last line of my PHP mail() script unexpected T_STRING [closed]