Emails not being sent in php

When I try to send an email with PHP and this code:

$to = "";
$subject = "Test";
$txt = "Test";
$headers = "From:";

my php.ini [mail function] :

[mail function]
sendmail_from =
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"

and sendmail.ini :


Can you please tell me what is wrong? There is no error and is my not what I typed in and same with and XXXXXXXXX

Don’t you need to enable SSL when sending via gmail? I recently did a VB project which required this. I also needed to sign into gmail and tell it to allow less secure apps to send email.

Generally people advise to steer clear of the built-in mail() function and use something like PHPMailer instead.

Not sure what this bit means sorry, perhaps you could clarify:

’ and is my not what I typed in and same with and XXXXXXXXX’ means that in my code stuff like XXXXXXXXX is not XXXXXXXXX, but say my password and is my gmail in my code and is my icloud email. I will try phpmailer and will try using ssl.