I'm not able to send mail from localhost. I tried to change configuration of php.ini
and sendmail.ini
as code of both file mentioned below.
This is my mail function from php file.
if (mail("exmaplesend@test.pk", "this is subject", "this is testing message", "From:example@gmail.com")) {
echo 'Email sent successfully!';
} else {
die('Failure: Email was not sent!');
}
and here is the the php.ini
configuration:
SMTP=localhost
SMTP =smtp.gmail.com
smtp_port =587
sendmail_from =example@gmail.com
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
and Sendmail.ini code is here:
account Gmail
tls on
tls_certcheck off
host smtp.gmail.com
from [example]@gmail.com
auth on
user [example]@gmail.com
password [**********]
port 587
account default : Gmail