Jump to content

mail function help


barnes

Recommended Posts

Hi to all,

i need some help about e mail sending.i am basic learner of php.

<?php
$to="[email protected]";
$subject="test mail";
$message="hello!shyam this is sample mail to you.";
$from="[email protected]";
$headers="From:$from";
mail($to,$subject,$message,$headers);
echo "mail sent";
?>

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.

Link to comment
https://forums.phpfreaks.com/topic/49751-mail-function-help/
Share on other sites

Ummm first off let's make sure you can connect to your mail server....

 

Hit start->run then type "cmd" no quotes

 

type "telnet localhost 25" no quotes and see if it connects....

 

If it doesn't then it's a problem with your mail server ;p.

 

(PS telnet doesn't come installed with Vista)

Link to comment
https://forums.phpfreaks.com/topic/49751-mail-function-help/#findComment-244051
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.