Click here to Skip to main content
15,901,122 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi friends,
This is my Email program using PHP.
I cant receive mail from this program.
Is there any changes on my program or any server setting needed. If needed for server settings or any other things please help me.
thank you.


<body>
<form method="post" action="" enctype="multipart/form-data">
username:<input type="text" name="name" id="name" />

Email:<input type="text" name="email" id="email" />

Coments:<input type="text" name="coment" id="coment" />

<input type="submit" name="submit" id="submit" value="send Email" />

</form>
</body>
</html>

if(isset($_POST['submit']))
{
$msg='Name:'.$_POST['name']."\n".'Email:'.$_POST['email']."\n".'Coment'.$_POST['coment'];

mail('lanka.raj007@gmail.com','sample content us form',$msg);
echo "mail sent";
}
?>
Posted

1 solution

You're missing the opening <?php tag

You shouldn't just ECHO "mail sent" without some sort of test for success: true of any sort of coding confirmation.

Depending upon the values in your php.ini file, you may need to use ini_set('SMTP', $server);, where $server is the reference to your SMTP mail server. If the mail server isn't valid you won't send anything anywhere.

IF the above is a faithful cut/paste of your file then, without the opening php tags you've functionally no php.
 
Share this answer
 
Comments
NagaRaju Pesarlanka 27-Sep-13 6:39am    
in my program I put

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900