0

I use newer xampp 1.8.3 and do the setting like the old one. I only changed the code in php.ini and sendmail.ini. And I use gmail to send emails from localhost.

Here is the changed code for php.ini:

//remove the semicolon
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"

And here is changed code for sendmail.php:

defaults
logfile "C:\xampp\sendmail\sendmail.log"

# SMTP Gmail
account Gmail
tls on
port 465
tls_starttls off
tls_certcheck off
host smtp.gmail.com
from my-gmail-id@gmail.com
auth on
user my-gmail-id@gmail.com
password my-gmail-password

account default : Gmail

And here is the code for sending email:

<?php
    $to = "my-gmail-id@gmail.com";
    $subject = "Send Email";
    $msg = "Send Email From Localhost";
    mail($to, $subject, $msg);
?>

Please help. Thank you.

AnFi
  • 10,493
  • 3
  • 23
  • 47
  • Possible duplication of [php mail() function on localhost](http://stackoverflow.com/questions/5342822/php-mail-function-on-localhost) – Ozair Patel May 09 '14 at 01:51
  • @OPatel no, it is successful, at [php mail() function on localhost](http://stackoverflow.com/questions/5342822/php-mail-function-on-localhost) it says `Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()` but I don't have those errors. The problem is the email I sent is not in my gmail inbox. – Rio Eduardo BG Simatupang May 09 '14 at 03:33
  • u can use phpmailer for sent mail from localhost – Mayur Kukadiya May 09 '14 at 05:20
  • @MayurKukadiya so we can't send email from localhost with the way I explained above? – Rio Eduardo BG Simatupang May 09 '14 at 06:36
  • i dont know about that but with phpmailer u can easy search multiple demo and document for sent mail from localhost ..so i had suggest for that.. – Mayur Kukadiya May 09 '14 at 12:23

0 Answers0