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 = "[email protected]";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$headers = "From: [email protected]" . "\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
[email protected]
auth_password=******
[email protected]

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 = [email protected]

; 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