0

I tried to send emails. I get the success message. But I receive no emails in my inbox. Is it because I installed xampp in D drive instead of C drive? This is my code:-

<?php

 $to = "bikloo.talukdar@gmail.com";

 $sub = "My Subject";

 $msg = "This is a test message";


 if (mail($to, $sub, $msg))
 {
     echo "Email sent successfully .....";
 }
 else
 {
     echo "Email not sent .....";
 }

?>

I have also made the settings in php.ini as:

SMTP=smtp.gmail.com
smtp_port=587
sendmail_from = bikloo.talukdar@gmail.com
sendmail_path = "\"D:xampp\sendmail\sendmail.exe\" -t"

My settings in sendmail.ini:

smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=bikloo.talukdar@gmail.com
auth_password=*********
force_sender=bikloo.talukdar@gmail.com

I have even allowed access to less secure apps. Still I am not receiving emails in my inbox. Can anyone help me?

Boidurja Talukdar
  • 676
  • 2
  • 21
  • 42
  • 1
    Does this answer your question? [PHP mail function doesn't complete sending of e-mail](https://stackoverflow.com/questions/24644436/php-mail-function-doesnt-complete-sending-of-e-mail) – M. Eriksson Nov 14 '20 at 11:08
  • My suggestion would be to use a tried and tested mail library like PHPMailer or SwiftMailer or similar instead of using the low level `mail()`-function. Those aren't just easier to use, they also are easier to debug and move (since you configure the SMTP in PHP instead of messing around with system settings on the server). – M. Eriksson Nov 14 '20 at 11:10

1 Answers1

1

There was a mistake in my path

sendmail_path = "\"D:xampp\sendmail\sendmail.exe\" -t"

should be

sendmail_path = "\"D:\xampp\sendmail\sendmail.exe\" -t"
Boidurja Talukdar
  • 676
  • 2
  • 21
  • 42