When i write a simple code to send mail it gives me warning like :
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().
This is my code:
<?php
if(mail("punam@adsoftech.com","hi","hello","from:punam@adsoftech.com"))
echo "sent";
else
echo "not sent";
?>
To send an email you need a SMTP server configured to handle it.
If you want to use mail()
function you should configure SMTP which PHP should connect to via php.ini or ini_set()
function.
Another way is to use a library like PHPMailer, but still you will need to configure it.