phpxamppsendmailsendmail.exe

Google preventing login from XAMPP server


I am trying to add a confirm email address feature to my web app. I configured the XAMPP server and changed all the required lines in php.ini and sendmail.ini But when I tried to send a mail, I got the following message from Google.

Screenshot of the mail

Can this be fixed?

I used the following link to configure

How to configure XAMPP to send mail from localhost?

The following is the code to send mail.

<?php
$to      = 'nikamanish007@gmail.com';
$subject = 'php mail';
$message = 'hello';
$headers = 'from manish';

if(mail($to, $subject, $message, $headers))
{
    echo 'mail sent';
}
else
{
    echo 'mail not sent';
}
?>

Solution

  • You need to enable Allow less secure apps: ON in your gmail account.

    1. Go to Gmail account security
    2. Click on Sign-in & Security
    3. Scroll down, there will be an option "Allow less secure apps" which is set to OFF by default, just turn on the setting and check.