Hi to all, i need some help about e mail sending.i am basic learner of php. <?php $to="shyamprasad5292001@gmail.com"; $subject="test mail"; $message="hello!shyam this is sample mail to you."; $from="shyamprasad_5292001@yahoo.com"; $headers="From:$from"; mail($to,$subject,$message,$headers); echo "mail sent"; ?> PHP: when i run this script i got following errors.how to fix these problems. Warning: 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:\easyphp1-8\www\mail.php on line 7 i am working on local host.i opened php.ini and saw this SMTP and smtp_port variable.please any one explain all modification in php.ini and reqiurements to send a mail.
You must define your STMP port (25) in php.ini file.. then restart Apache server. You can check options us(.)php(.)net (/)mail
If you are using Windows, you just have to check the SMTP and smtp_port settings. SMTP tells you which mail server php is using and smtp_port tells the port. So you just have to change SMTP to your ISP's mail server and smtp_port to the port your ISP is using (usually you don't have to change this at all). Neoto
Well usually this information is easily available on your Internet service provider's website. If you are using an e-mail client like Thunderbird or Outlook, you can find the correct mail server from the programs settings. Just find out which server you are using for outgoing mail and use the same one in the php.ini. In 99,99% of cases the port is 25, but if it is something else you should also find it from the programs settings (or the website).