I've been learning php and following the examples on w3schools until I came to this example and now I'm pretty stuck after having tried to make it work for countless hours.
This is the bit I'm on: http://www.w3schools.com/php/php_mail.asp
I try to send the email using the following code:
<?php $to = "email@example.com"; //I changed this with my email address $subject = "Test mail"; $message = "Hello! This is a simple email message."; $from = "firstname.lastname@example.org"; $headers = "From:" . $from; mail($to,$subject,$message,$headers); echo "Mail Sent."; ?>
When I open the page I get the following error 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()
I've tried to find out about it on google apparently the php.ini file needs to be changed to accomodate this but some of the instructions were written in a very complicated way and I was unable to follow so if it can be explained in simple terms - it would be greatly appreciated!