0

Am sending mail from localhost.I've configured php.ini and sendmail.ini. I've change php.ini file which now look something like this

; XAMPP: Comment out this if you want to work with fakemail for forwarding to your mailbox (sendmail.exe in the sendmail folder)
sendmail_path = ""D:\xampp\sendmail\sendmail.exe\" -t"\\I've removed the backslash coming before D n I get true but when I use with backslash then mail function return false

; XAMPP: Comment out this if you want to work with mailToDisk, It writes all mails in the D:\xampp\mailoutput folder
;sendmail_path = "D:\xampp\mailtodisk\mailtodisk.exe"

sendmail.ini

  smtp_server=smtp.gmail.com    
 ; smtp port (normally 25)
  smtp_port=587
  auth_username=bsr.anwar@gmail.com
  auth_password=********

php code

            $subject = "Reset Password";
            $message = "To reset your Password please go to <a href='localhost/task2/reset_password.php?email=$to&reset_token=$token'>localhost/task2/reset_password.php?email=$to&reset_token=$token</a>";
            $headers = "From:bsr.anwar@gmail.com\r\n";
            return mail($to, $subject,$message,$headers);
asim
  • 103
  • 1
  • 8

1 Answers1

0

Use the PHPMailer plugin.. https://github.com/PHPMailer/PHPMailer It's fast and easy to use. You can get the documentation and tutorial here.

Arun Babu
  • 108
  • 2
  • 13