0

I'm new in php and i try send mail, but...

if(isset($_POST['apmoketi'])){ 


 $admin_email = "silumospausaulis@gmail.com";
  $subject ='Užsakymas';
  $comment = 'Jūsų užsakymas priimtas.'


      //send email
      mail( $subject, "RSVP from WC Entry Form",
       "From: $admin_email, \n Name: $vardas $pavarde \n 
       Miestas: $miestas \n 
       Address: $postal \n ");

      //Email response
      echo "Thank you for contacting us!";}

I have change settings in php.ini

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP=smtp.gmail.com
;SMTP=smtp.mail.yahoo.com
; http://php.net/smtp-port
smtp_port=587
;smtp_port=587

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from=silumospausaulis@gmail.com

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"

and in sendmail.ini

smtp_server=smtp.gmail.com
smtp_port=587
smtp_ssl=auto
error_logfile=error.log
debug_logfile=debug.log
pop3_server=
pop3_username=
pop3_password=
force_recipient=
hostname=

Error:-

syntax error, unexpected 'mail' (T_STRING) in C:\xampp\htdocs\ch.php on line 35

Any one can help with it?

jasinth premkumar
  • 1,430
  • 1
  • 12
  • 22

1 Answers1

1

As you are new to PHP , Debug always your code seeing the line no. you can find the good reference here about the common errors in your script PHP Parse/Syntax Errors; and How to solve them?

$comment = 'Jūsų užsakymas priimtas.';  // you missing semicolon here
Dhairya Lakhera
  • 4,445
  • 3
  • 35
  • 62
  • 3
    There is a flag for this: off-topic -> _This question was caused by a problem that can no longer be reproduced or **a simple typographical error**. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting._ – FirstOne Dec 10 '17 at 12:07