0

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';
}
?>
Community
  • 1
  • 1
nikamanish
  • 662
  • 4
  • 17
  • Please provide more detail when you configured it, to make it more clear. Do you use OAuth or whatever it's. – Eko Junaidi Salam Jan 18 '16 at 01:58
  • I'm sure this is a Google thing, your solution is to understand their security requirements and use them accordingly. For example, you may not be using SSL/TLS which could be a requirement. The error message is right there "Someone just tried to login via an insecure app" However you can disable that somewhere in your config. [See this support FAQ](https://support.google.com/accounts/answer/6010255?hl=en) – Ash Jan 18 '16 at 17:28

1 Answers1

4

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.
Paul Roub
  • 36,322
  • 27
  • 84
  • 93