0

I am trying to send some basic text data from a html form to an email. I found an article online with the php code contain below. Here is the link to the article https://html.form.guide/email-form/php-form-to-email/. I am using easyphp dev server to run my code and it is reporting an error on line 22 of the php file. Here is the error:

Parse error: syntax error, unexpected 'mail' (T_STRING) in C:\Program Files (x86)\EasyPHP-Devserver-17\eds-www\form-to-email.php on line 22.

Any help in clarifying what this means would be greatly appreciated as this is my first time attempting this. Thanks in advance.

<?php
$name = $_POST['name'];
$visitor_email = $_POST['email'];
$message = $_POST['message'];

$email_from = 'exampleemail@example.com';

$email_subject = "New Form submission";

$email_body = "You have received a new message from the user $name.\n".
                        "Here is the message:\n $message".
                        

$to = "exampleemail@example.com";

$headers = "From: $email_from \r\n";

$headers .= "Reply-To: $visitor_email \r\n";


ini_set(25)
mail($to,$email_subject, $email_body,$headers);

?>
RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
Euan
  • 1
  • 2
    `ini_set(25)` ?? Not at all sure what that is in there for, and without a `;` its even worse. Also I dont see that in the tutorial you are following?? Why did you add that – RiggsFolly Jan 18 '22 at 11:02
  • You are missing a semicolon on the line `ini_set(25)`. Also check the line for `$email_body`, seems incomplete. – kiner_shah Jan 18 '22 at 11:03

0 Answers0