I am currently using xampp 1.7.0
and my php version is 5.2.8
I changed my php.ini
file to:
[mail function]
; For Win32 only.
SMTP = smtp.gmail.com
smtp_port = 465
and my send_email.php file looks like:
$to = "[email protected]";
$subject = "Test mail";
$message = "Hello! This is a test message.";
$from = "[email protected]";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
But, it shows the following message:
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() in C:\xampp\htdocs\NFL\send_email.php on line 15
Line number 15 is:
mail($to,$subject,$message,$headers);
How can I resolve this issue?
Note: I also added a 5th parameter to the mail call to force the system to use the From Email Address, but it didn't worked!
I got the solution to my own question. The problem was:
At first I was changing the php.ini
file from C:\xampp\php\
But, when I did
echo phpinfo();
die();
I found the loaded configuration file
was:
C:\xampp\apache\bin\php.ini
So, I changed
SMTP = localhost
smtp_port = 25
to
SMTP = smtp.wlink.com.np
smtp_port = 25
And it worked!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With