I have a problem with sending e-mails from localhost (XAMPP 3.2.1). I want to send e-mails using the Gmail inbox.
In my case, I did everything like in this tutorial:http://www.websnippetz.com/php/send-email-from-xampp-localhost/
sendmail.ini
smtp_server=smtp.gmail.com
smtp_port=25
error_logfile=error.log
debug_logfile=debug.log
auth_username=yourname@gmail.com
auth_password=gmailpassword
force_sender=yourname@gmail.com
php.ini
[mail function]
SMTP = smtp.gmail.com
smtp_port = 25
sendmail_from = yourname@gmail.com
sendmail_path = "\"D:\xampp\sendmail\sendmail.exe\"-t"
mail.add_x_header = Off
Then reboot the server.
My code for sending email:
<?php
$to = "tome@example.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
echo("<p>Email successfully sent!</p>");
} else {
echo("<p>Email delivery failed…</p>");
}
?>
After running the code - there is nothing in my mailbox... Please for help.