2

Please help me, I was tried it for many times. the code was success but I didn't receive any e-mail in my inbox or spam folder

I run this on localhost with internet connection. I trying to send it from localhost to gmail. is that possible?

this is my mail.php

 <?php
$to = "test@gmail.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$headers = "From: test@gmail.com" . "\r\n";
if (mail($to, $subject, $body, $headers)) {
    echo ("Message successfully sent!");
} else {
    echo ("Message delivery failed...");
}
?>

sendmail.ini

[sendmail]
smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=test@gmail.com
auth_password=******
force_sender=test@gmail.com

php.ini

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = smtp.gmail.com
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = henrikus.antony@gmail.com

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
Henrikus Anthony
  • 154
  • 2
  • 4
  • 12

0 Answers0